com.phoenix_int.util
Class BufferedRandomAccessFile
java.lang.Object
com.phoenix_int.util.BufferedRandomAccessFile
public class BufferedRandomAccessFile
- extends java.lang.Object
Replacement for RandomAccessFile to use buffered I/O as much as
possible.
Mostly identical to java.io.RandomAccessFile API,
or at least as close enough for what I needed.
Note: This class is not threadsafe.
- See Also:
RandomAccessFile
|
Constructor Summary |
BufferedRandomAccessFile(java.io.File file,
java.lang.String mode,
int bufSize)
Constructs a BufferedRandomAccessFile |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_wrapped
protected java.io.RandomAccessFile _wrapped
_filePos
protected long _filePos
_fileLen
protected long _fileLen
_actualPos
protected long _actualPos
_bufStart
protected long _bufStart
_buffer
protected byte[] _buffer
_writeOffset
protected int _writeOffset
_readOffset
protected int _readOffset
BufferedRandomAccessFile
public BufferedRandomAccessFile(java.io.File file,
java.lang.String mode,
int bufSize)
throws java.io.IOException
- Constructs a BufferedRandomAccessFile
- Parameters:
file - - The file to openmode - - Same as for RandomAccessFile's constructorbufSize - - How big to make the in-memory cache.
- Throws:
java.io.IOException
length
public long length()
throws java.io.IOException
- Throws:
java.io.IOException
seek
public void seek(long position)
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] buf)
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] buf,
int offset,
int len)
throws java.io.IOException
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(byte[] buf)
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(byte[] buf,
int offset,
int len)
throws java.io.IOException
- Throws:
java.io.IOException
_readBuf
public boolean _readBuf()
throws java.io.IOException
- Throws:
java.io.IOException