public class RandomAccessReader extends java.io.RandomAccessFile implements FileDataInput
| Modifier and Type | Class and Description |
|---|---|
protected static class |
RandomAccessReader.BufferedRandomAccessFileMark
Class to hold a mark to the position of the file
|
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buffer |
protected long |
bufferOffset |
static long |
CACHE_FLUSH_INTERVAL_IN_BYTES |
protected java.nio.channels.FileChannel |
channel |
protected long |
current |
static int |
DEFAULT_BUFFER_SIZE |
protected long |
markedPointer |
protected PoolingSegmentedFile |
owner |
protected int |
validBufferBytes |
| Modifier | Constructor and Description |
|---|---|
protected |
RandomAccessReader(java.io.File file,
int bufferSize,
PoolingSegmentedFile owner) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
bufferCursor() |
long |
bytesPastMark() |
long |
bytesPastMark(FileMark mark) |
long |
bytesRemaining() |
void |
close() |
void |
deallocate() |
long |
getFilePointer() |
java.lang.String |
getPath() |
int |
getTotalBufferSize() |
boolean |
isEOF() |
long |
length() |
FileMark |
mark() |
static RandomAccessReader |
open(java.io.File file) |
static RandomAccessReader |
open(java.io.File file,
PoolingSegmentedFile owner) |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buff,
int offset,
int length) |
java.nio.ByteBuffer |
readBytes(int length)
Read length bytes from current file position
|
protected void |
reBuffer()
Read data from file starting from current currentOffset to populate buffer.
|
void |
reset() |
void |
reset(FileMark mark) |
protected void |
resetBuffer() |
void |
seek(long newPosition) |
java.lang.String |
toString() |
void |
write(byte[] buffer) |
void |
write(byte[] buffer,
int offset,
int length) |
void |
write(int value) |
getChannel, getFD, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFpublic static final long CACHE_FLUSH_INTERVAL_IN_BYTES
public static final int DEFAULT_BUFFER_SIZE
protected byte[] buffer
protected long bufferOffset
protected long current
protected long markedPointer
protected int validBufferBytes
protected final java.nio.channels.FileChannel channel
protected final PoolingSegmentedFile owner
protected RandomAccessReader(java.io.File file,
int bufferSize,
PoolingSegmentedFile owner)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic static RandomAccessReader open(java.io.File file, PoolingSegmentedFile owner)
public static RandomAccessReader open(java.io.File file)
protected void reBuffer()
public long getFilePointer()
getFilePointer in interface FileDataInputgetFilePointer in class java.io.RandomAccessFilepublic java.lang.String getPath()
getPath in interface FileDataInputpublic int getTotalBufferSize()
public void reset()
public long bytesPastMark()
public FileMark mark()
mark in interface FileDataInputpublic void reset(FileMark mark)
reset in interface FileDataInputpublic long bytesPastMark(FileMark mark)
bytesPastMark in interface FileDataInputpublic boolean isEOF()
isEOF in interface FileDataInputpublic long bytesRemaining()
bytesRemaining in interface FileDataInputprotected int bufferCursor()
protected void resetBuffer()
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.RandomAccessFilepublic void deallocate()
public java.lang.String toString()
toString in class java.lang.Objectpublic void seek(long newPosition)
seek in interface FileDataInputseek in class java.io.RandomAccessFilepublic int read()
read in class java.io.RandomAccessFilepublic int read(byte[] buffer)
read in class java.io.RandomAccessFilepublic int read(byte[] buff,
int offset,
int length)
read in class java.io.RandomAccessFilepublic java.nio.ByteBuffer readBytes(int length)
throws java.io.EOFException
FileDataInputreadBytes in interface FileDataInputlength - length of the bytes to readjava.io.EOFExceptionpublic long length()
length in class java.io.RandomAccessFilepublic void write(int value)
write in interface java.io.DataOutputwrite in class java.io.RandomAccessFilepublic void write(byte[] buffer)
write in interface java.io.DataOutputwrite in class java.io.RandomAccessFilepublic void write(byte[] buffer,
int offset,
int length)
write in interface java.io.DataOutputwrite in class java.io.RandomAccessFileCopyright © 2015 The Apache Software Foundation