|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.RandomAccessFile
com.ureach.detorres.util.BufferedRandomAccessFile
public class BufferedRandomAccessFile
This class provides an unsynchronized, buffered RandomAccessFile. It is way, way, way faster (like 25 or 50 times faster) than RandomAccessFile even with a small buffer size of 1024 bytes. This class is from JavaWorld Java Tip 26.
Constructor Summary | |
---|---|
BufferedRandomAccessFile(String fileName,
String mode,
int bufSize)
Creates a new BufferedRandomAccessFile. |
Method Summary | |
---|---|
long |
getFilePointer()
Returns the virtual file pointer. |
String |
getNextLine()
Replaces RandomAccessFile's readLine method which is final. |
int |
read()
Returns the next byte in the file. |
int |
read(byte[] b,
int off,
int len)
Reads a block of bytes into an array. |
void |
seek(long pos)
Seeks to a particular byte in the file. |
Methods inherited from class java.io.RandomAccessFile |
---|
close, getChannel, getFD, length, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BufferedRandomAccessFile(String fileName, String mode, int bufSize) throws IOException
fileName
- mode
- bufSize
-
IOException
Method Detail |
---|
public final int read() throws IOException
read
in class RandomAccessFile
IOException
- on any read errorpublic int read(byte[] b, int off, int len) throws IOException
read
in class RandomAccessFile
b
- the destination arrayoff
- the offset into buf to start writing byteslen
- the number of bytes to read
IOException
public long getFilePointer() throws IOException
getFilePointer
in class RandomAccessFile
IOException
public void seek(long pos) throws IOException
seek
in class RandomAccessFile
pos
- the desired file position
IOException
public final String getNextLine() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |