Methods Summary |
---|
public void | close()
super.close();
raf.close();
|
public long | length()
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)Sets the current stream position and resets the bit offset to
0. It is legal to seeking past the end of the file; an
EOFException will be thrown only if a read is
performed. The file length will not be increased until a write
is performed.
checkClosed();
if (pos < flushedPos) {
throw new IndexOutOfBoundsException("pos < flushedPos!");
}
bitOffset = 0;
raf.seek(pos);
streamPos = raf.getFilePointer();
|
public void | write(int b)
checkClosed();
flushBits();
raf.write(b);
++streamPos;
|
public void | write(byte[] b, int off, int len)
checkClosed();
flushBits();
raf.write(b, off, len);
streamPos += len;
|