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 |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
protected long |
markedPointer |
static int |
MAX_BUFFER_SIZE |
buffer| Modifier | Constructor and Description |
|---|---|
protected |
RandomAccessReader(Rebufferer rebufferer) |
| Modifier and Type | Method and Description |
|---|---|
static java.nio.ByteBuffer |
allocateBuffer(int size,
BufferType bufferType) |
int |
available() |
static RandomAccessReader |
build(SegmentedFile file,
com.google.common.util.concurrent.RateLimiter limiter) |
static RandomAccessReader.Builder |
builder(ChannelProxy channel) |
long |
bytesPastMark() |
long |
bytesPastMark(DataPosition mark) |
long |
bytesRemaining() |
void |
close() |
protected long |
current() |
ChannelProxy |
getChannel() |
double |
getCrcCheckChance() |
long |
getFilePointer() |
java.lang.String |
getPath() |
long |
getPosition() |
protected static Rebufferer |
instantiateRebufferer(RebuffererFactory fileRebufferer,
com.google.common.util.concurrent.RateLimiter limiter) |
boolean |
isEOF() |
long |
length() |
DataPosition |
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.
|
void |
reBufferAt(long position) |
void |
reset() |
void |
reset(DataPosition 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 long markedPointer
protected RandomAccessReader(Rebufferer rebufferer)
public static java.nio.ByteBuffer allocateBuffer(int size,
BufferType bufferType)
public void reBuffer()
reBuffer in class RebufferingInputStreampublic void reBufferAt(long position)
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 java.io.InputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.InputStreampublic long bytesPastMark()
public DataPosition mark()
mark in interface RewindableDataInputpublic void reset(DataPosition mark)
reset in interface RewindableDataInputpublic long bytesPastMark(DataPosition mark)
bytesPastMark in interface RewindableDataInputpublic 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 double getCrcCheckChance()
protected static Rebufferer instantiateRebufferer(RebuffererFactory fileRebufferer, com.google.common.util.concurrent.RateLimiter limiter)
public static RandomAccessReader build(SegmentedFile file, com.google.common.util.concurrent.RateLimiter limiter)
public static RandomAccessReader.Builder builder(ChannelProxy channel)
public static RandomAccessReader open(java.io.File file)
public static RandomAccessReader open(ChannelProxy channel)
Copyright © 2017 The Apache Software Foundation