|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.RandomAccessFile
de.schlichtherle.io.rof.FastReadOnlyFile
public class FastReadOnlyFile
A ReadOnlyFile
implementation using a RandomAccessFile
with
a cached file pointer.
This implementation skips unnecessary file pointer operations for the
operating system.
Constructor Summary | |
---|---|
FastReadOnlyFile(File file)
Deprecated. |
Method Summary | |
---|---|
void |
close()
Deprecated. |
long |
getFilePointer()
Deprecated. |
int |
read()
Deprecated. |
int |
read(byte[] b,
int off,
int len)
Deprecated. Reads up to len bytes of data from this read only file into
the given array. |
void |
seek(long pos)
Deprecated. Sets the file pointer offset, measured from the beginning of this file, at which the next read occurs. |
Methods inherited from class java.io.RandomAccessFile |
---|
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 |
Methods inherited from interface de.schlichtherle.io.rof.ReadOnlyFile |
---|
length, read, readFully, readFully, skipBytes |
Constructor Detail |
---|
public FastReadOnlyFile(File file) throws FileNotFoundException
FileNotFoundException
Method Detail |
---|
public long getFilePointer() throws IOException
getFilePointer
in interface ReadOnlyFile
getFilePointer
in class RandomAccessFile
IOException
public void seek(long pos) throws IOException
ReadOnlyFile
SimpleReadOnlyFile
subclasses
RandomAccessFile
and passes "r"
as a
parameter to the superclass constructor.
On the Windows platform, this implementation allows to seek past the
end of file, but on the Linux platform it doesn't.
seek
in interface ReadOnlyFile
seek
in class RandomAccessFile
pos
- The offset position, measured in bytes from the beginning
of the file, at which to set the file pointer.
IOException
- If pos
is less than 0
or if
an I/O error occurs.public int read() throws IOException
read
in interface ReadOnlyFile
read
in class RandomAccessFile
IOException
public int read(byte[] b, int off, int len) throws IOException
ReadOnlyFile
len
bytes of data from this read only file into
the given array.
This method blocks until at least one byte of input is available.
read
in interface ReadOnlyFile
read
in class RandomAccessFile
b
- The buffer to fill with data.off
- The start offset of the data.len
- The maximum number of bytes to read.
-1
if there is
no more data because the end of the file has been reached.
IOException
- On any I/O related issue.public void close() throws IOException
close
in interface ReadOnlyFile
close
in interface Closeable
close
in class RandomAccessFile
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |