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, skipBytes
public 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 FileDataInput
protected long current()
public java.lang.String getPath()
getPath
in interface FileDataInput
public int getTotalBufferSize()
public void reset()
reset
in class java.io.InputStream
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
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
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 AbstractDataInput
public int read()
read
in class java.io.InputStream
public int read(byte[] buffer)
read
in class java.io.InputStream
public int read(byte[] buff, int offset, int length)
read
in class java.io.InputStream
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()
public long getPosition()
getPosition
in class AbstractDataInput
public long getPositionLimit()
getPositionLimit
in class AbstractDataInput
Copyright © 2020 The Apache Software Foundation