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, writeUTF
public 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.FileNotFoundException
public 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 FileDataInput
getFilePointer
in class java.io.RandomAccessFile
public java.lang.String getPath()
getPath
in interface FileDataInput
public int getTotalBufferSize()
public void reset()
public long bytesPastMark()
public FileMark mark()
mark
in interface FileDataInput
public void reset(FileMark mark)
reset
in interface FileDataInput
public long bytesPastMark(FileMark mark)
bytesPastMark
in interface FileDataInput
public boolean isEOF()
isEOF
in interface FileDataInput
public long bytesRemaining()
bytesRemaining
in interface FileDataInput
protected int bufferCursor()
protected void resetBuffer()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.RandomAccessFile
public void deallocate()
public java.lang.String toString()
toString
in class java.lang.Object
public void seek(long newPosition)
seek
in interface FileDataInput
seek
in class java.io.RandomAccessFile
public int read()
read
in class java.io.RandomAccessFile
public int read(byte[] buffer)
read
in class java.io.RandomAccessFile
public int read(byte[] buff, int offset, int length)
read
in class java.io.RandomAccessFile
public java.nio.ByteBuffer readBytes(int length) throws java.io.EOFException
FileDataInput
readBytes
in interface FileDataInput
length
- length of the bytes to readjava.io.EOFException
public long length()
length
in class java.io.RandomAccessFile
public void write(int value)
write
in interface java.io.DataOutput
write
in class java.io.RandomAccessFile
public void write(byte[] buffer)
write
in interface java.io.DataOutput
write
in class java.io.RandomAccessFile
public void write(byte[] buffer, int offset, int length)
write
in interface java.io.DataOutput
write
in class java.io.RandomAccessFile
Copyright © 2015 The Apache Software Foundation