public class RandomAccessReader extends RebufferingInputStream implements FileDataInput
| Modifier and Type | Class and Description |
|---|---|
protected static class |
RandomAccessReader.BufferedRandomAccessFileMark
Class to hold a mark to the position of the file
|
static class |
RandomAccessReader.Builder |
static class |
RandomAccessReader.RandomAccessReaderWithOwnChannel |
DataInputPlus.DataInputStreamPlus| Modifier and Type | Field and Description |
|---|---|
protected long |
bufferOffset |
protected int |
bufferSize |
protected BufferType |
bufferType |
protected ChannelProxy |
channel |
static int |
DEFAULT_BUFFER_SIZE |
protected com.google.common.util.concurrent.RateLimiter |
limiter |
protected long |
markedPointer |
static int |
MAX_BUFFER_SIZE |
protected MmappedRegions |
regions |
buffer| Modifier | Constructor and Description |
|---|---|
protected |
RandomAccessReader(RandomAccessReader.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
protected static java.nio.ByteBuffer |
allocateBuffer(int size,
BufferType bufferType) |
int |
available() |
long |
bytesPastMark() |
long |
bytesPastMark(FileMark mark) |
long |
bytesRemaining() |
void |
close() |
protected long |
current() |
ChannelProxy |
getChannel() |
long |
getFilePointer() |
java.lang.String |
getPath() |
long |
getPosition() |
boolean |
isEOF() |
long |
length() |
FileMark |
mark() |
boolean |
markSupported() |
static RandomAccessReader |
open(ChannelProxy channel) |
static RandomAccessReader |
open(java.io.File file) |
java.lang.String |
readLine()
Reads a line of text form the current position in this file.
|
void |
reBuffer()
Read data from file starting from current currentOffset to populate buffer.
|
protected void |
reBufferMmap() |
protected void |
reBufferStandard() |
protected void |
releaseBuffer() |
void |
reset() |
void |
reset(FileMark mark) |
void |
seek(long newPosition) |
java.lang.String |
toString() |
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLong, readPrimitiveSlowly, readShort, readUnsignedByte, readUnsignedShort, readUnsignedVInt, readUTF, readVInt, skipBytesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitreadUnsignedVInt, readVInt, skipBytes, skipBytesFullypublic static final int DEFAULT_BUFFER_SIZE
public static final int MAX_BUFFER_SIZE
protected final ChannelProxy channel
protected final MmappedRegions regions
protected final com.google.common.util.concurrent.RateLimiter limiter
protected final int bufferSize
protected final BufferType bufferType
protected long bufferOffset
protected long markedPointer
protected RandomAccessReader(RandomAccessReader.Builder builder)
protected static java.nio.ByteBuffer allocateBuffer(int size,
BufferType bufferType)
protected void releaseBuffer()
public void reBuffer()
reBuffer in class RebufferingInputStreamprotected void reBufferStandard()
protected void reBufferMmap()
public long getFilePointer()
getFilePointer in interface FileDataInputprotected long current()
public java.lang.String getPath()
getPath in interface FileDataInputpublic ChannelProxy getChannel()
public void reset()
throws java.io.IOException
reset in class RebufferingInputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class RebufferingInputStreampublic 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 int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreampublic java.lang.String toString()
toString in class java.lang.Objectpublic void seek(long newPosition)
seek in interface FileDataInputpublic final java.lang.String readLine()
throws java.io.IOException
'\n', '\r', "\r\n" or the end of file marker. The string does not
include the line terminating sequence.
Blocks until a line terminating sequence has been read, the end of the
file is reached or an exception is thrown.readLine in interface java.io.DataInputreadLine in class RebufferingInputStreamnull if no characters have
been read before the end of the file has been reached.java.io.IOException - if this file is closed or another I/O error occurs.public long length()
public long getPosition()
public static RandomAccessReader open(java.io.File file)
public static RandomAccessReader open(ChannelProxy channel)
Copyright © 2016 The Apache Software Foundation