Methods Summary |
---|
public void | close()
super.close();
disposerRecord.dispose(); // this closes the RandomAccessFile
raf = null;
|
protected void | finalize(){@inheritDoc}
// Empty finalizer: for performance reasons we instead use the
// Disposer mechanism for ensuring that the underlying
// RandomAccessFile is closed prior to garbage collection
|
public long | length()Returns the length of the underlying file, or -1
if it is unknown.
try {
checkClosed();
return raf.length();
} catch (IOException e) {
return -1L;
}
|
public int | read()
checkClosed();
bitOffset = 0;
int val = raf.read();
if (val != -1) {
++streamPos;
}
return val;
|
public int | read(byte[] b, int off, int len)
checkClosed();
bitOffset = 0;
int nbytes = raf.read(b, off, len);
if (nbytes != -1) {
streamPos += nbytes;
}
return nbytes;
|
public void | seek(long pos)
checkClosed();
if (pos < flushedPos) {
throw new IndexOutOfBoundsException("pos < flushedPos!");
}
bitOffset = 0;
raf.seek(pos);
streamPos = raf.getFilePointer();
|