org.cdlib.xtf.saxonExt.pipe
Class BufferedRandomAccessFile
Object
RandomAccessFileOrArray
BufferedRandomAccessFile
- All Implemented Interfaces:
- DataInput
class BufferedRandomAccessFile
- extends RandomAccessFileOrArray
Class to provide buffered, random access to a PDF file. Useful for when we
can't realistically fit a PDF file into memory.
- Author:
- Martin Haye
Methods inherited from class RandomAccessFileOrArray |
InputStreamToArray, insureOpen, read, readBoolean, readByte, readChar, readCharLE, readDouble, readDoubleLE, readFloat, readFloatLE, readFully, readFully, readInt, readIntLE, readLine, readLong, readLongLE, readShort, readShortLE, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedShort, readUnsignedShortLE, readUTF, skip |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
baseFile
RandomAccessFile baseFile
prevByte
byte prevByte
havePrevByte
boolean havePrevByte
BUFFER_SIZE
final int BUFFER_SIZE
- See Also:
- Constant Field Values
buffer
byte[] buffer
startOffset
int startOffset
bufferLength
int bufferLength
bufferPos
int bufferPos
bufferFilePointer
int bufferFilePointer
BufferedRandomAccessFile
public BufferedRandomAccessFile(String filename)
throws IOException
- Throws:
IOException
pushBack
public void pushBack(byte b)
- Overrides:
pushBack
in class RandomAccessFileOrArray
fillBuffer
private void fillBuffer()
throws IOException
- Fill our buffer with data at the current file pointer.
- Throws:
IOException
read
public int read()
throws IOException
- Overrides:
read
in class RandomAccessFileOrArray
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Overrides:
read
in class RandomAccessFileOrArray
- Throws:
IOException
skipBytes
public int skipBytes(int n)
throws IOException
- Specified by:
skipBytes
in interface DataInput
- Overrides:
skipBytes
in class RandomAccessFileOrArray
- Throws:
IOException
reOpen
public void reOpen()
throws IOException
- Overrides:
reOpen
in class RandomAccessFileOrArray
- Throws:
IOException
isOpen
public boolean isOpen()
- Overrides:
isOpen
in class RandomAccessFileOrArray
close
public void close()
throws IOException
- Overrides:
close
in class RandomAccessFileOrArray
- Throws:
IOException
setStartOffset
public void setStartOffset(int off)
- Overrides:
setStartOffset
in class RandomAccessFileOrArray
getStartOffset
public int getStartOffset()
- Overrides:
getStartOffset
in class RandomAccessFileOrArray
length
public int length()
throws IOException
- Overrides:
length
in class RandomAccessFileOrArray
- Throws:
IOException
seek
public void seek(int pos)
throws IOException
- Overrides:
seek
in class RandomAccessFileOrArray
- Throws:
IOException
seek
public void seek(long pos)
throws IOException
- Overrides:
seek
in class RandomAccessFileOrArray
- Throws:
IOException
getFilePointer
public int getFilePointer()
throws IOException
- Overrides:
getFilePointer
in class RandomAccessFileOrArray
- Throws:
IOException
getNioByteBuffer
public ByteBuffer getNioByteBuffer()
throws IOException
- Overrides:
getNioByteBuffer
in class RandomAccessFileOrArray
- Throws:
IOException