public class RandomAccessReader extends AbstractDataInput 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 java.nio.ByteBuffer |
buffer |
static int |
BUFFER_SIZE |
protected long |
bufferOffset |
protected ChannelProxy |
channel |
static int |
DEFAULT_BUFFER_SIZE |
protected long |
markedPointer |
protected PoolingSegmentedFile |
owner |
| Modifier | Constructor and Description |
|---|---|
protected |
RandomAccessReader(ChannelProxy channel,
int bufferSize,
long overrideLength,
BufferType bufferType,
PoolingSegmentedFile owner) |
| Modifier and Type | Method and Description |
|---|---|
protected java.nio.ByteBuffer |
allocateBuffer(int bufferSize,
BufferType bufferType) |
long |
bytesPastMark() |
long |
bytesPastMark(FileMark mark) |
long |
bytesRemaining() |
void |
close() |
protected long |
current() |
void |
deallocate() |
ChannelProxy |
getChannel() |
long |
getFilePointer() |
java.lang.String |
getPath() |
long |
getPosition() |
long |
getPositionLimit() |
int |
getTotalBufferSize() |
boolean |
isEOF() |
long |
length() |
FileMark |
mark() |
static RandomAccessReader |
open(ChannelProxy channel) |
static RandomAccessReader |
open(ChannelProxy channel,
long overrideSize) |
static RandomAccessReader |
open(ChannelProxy channel,
long overrideSize,
PoolingSegmentedFile owner) |
static RandomAccessReader |
open(java.io.File file) |
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) |
void |
seek(long newPosition) |
java.lang.String |
toString() |
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytespublic static final int DEFAULT_BUFFER_SIZE
public static final int BUFFER_SIZE
protected java.nio.ByteBuffer buffer
protected long bufferOffset
protected long markedPointer
protected final ChannelProxy channel
protected final PoolingSegmentedFile owner
protected RandomAccessReader(ChannelProxy channel, int bufferSize, long overrideLength, BufferType bufferType, PoolingSegmentedFile owner)
protected java.nio.ByteBuffer allocateBuffer(int bufferSize,
BufferType bufferType)
public static RandomAccessReader open(ChannelProxy channel, long overrideSize, PoolingSegmentedFile owner)
public static RandomAccessReader open(java.io.File file)
public static RandomAccessReader open(ChannelProxy channel)
public static RandomAccessReader open(ChannelProxy channel, long overrideSize)
public ChannelProxy getChannel()
protected void reBuffer()
public long getFilePointer()
getFilePointer in interface FileDataInputprotected long current()
public java.lang.String getPath()
getPath in interface FileDataInputpublic int getTotalBufferSize()
public void reset()
reset in class java.io.InputStreampublic 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 FileDataInputpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreampublic void deallocate()
public java.lang.String toString()
toString in class java.lang.Objectpublic void seek(long newPosition)
seek in interface FileDataInputseek in class AbstractDataInputpublic int read()
read in class java.io.InputStreampublic int read(byte[] buffer)
read in class java.io.InputStreampublic int read(byte[] buff,
int offset,
int length)
read in class java.io.InputStreampublic java.nio.ByteBuffer readBytes(int length)
throws java.io.EOFException
FileDataInputreadBytes in interface FileDataInputlength - length of the bytes to readjava.io.EOFExceptionpublic long length()
public long getPosition()
getPosition in class AbstractDataInputpublic long getPositionLimit()
getPositionLimit in class AbstractDataInputCopyright © 2018 The Apache Software Foundation