@NotThreadSafe public class RandomAccessReader extends RebufferingInputStream implements FileDataInput
DataInputPlus.DataInputStreamPlus
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE |
buffer
Modifier and Type | Method and Description |
---|---|
int |
available() |
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() |
boolean |
isEOF() |
long |
length() |
DataPosition |
mark() |
boolean |
markSupported() |
static RandomAccessReader |
open(java.io.File file)
Open a RandomAccessReader (not compressed, not mmapped, no read throttling) that will own its channel.
|
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 |
reset() |
void |
reset(DataPosition mark) |
void |
seek(long newPosition) |
int |
skipBytes(int n)
Always skips the requested number of bytes, unless EOF is reached
|
java.lang.String |
toString() |
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readFully, readInt, readLong, readPrimitiveSlowly, readShort, readUnsignedByte, readUnsignedShort, readUnsignedVInt, readUTF, readVInt
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
readUnsignedVInt, readVInt, skipBytesFully
public static final int DEFAULT_BUFFER_SIZE
public void reBuffer()
reBuffer
in class RebufferingInputStream
public long getFilePointer()
getFilePointer
in interface FileDataInput
protected long current()
public java.lang.String getPath()
getPath
in interface FileDataInput
public ChannelProxy getChannel()
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public boolean markSupported()
markSupported
in class java.io.InputStream
public long bytesPastMark()
public DataPosition mark()
mark
in interface RewindableDataInput
public void reset(DataPosition mark)
reset
in interface RewindableDataInput
public long bytesPastMark(DataPosition mark)
bytesPastMark
in interface RewindableDataInput
public boolean isEOF()
isEOF
in interface FileDataInput
public long bytesRemaining()
bytesRemaining
in interface FileDataInput
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
public java.lang.String toString()
toString
in class java.lang.Object
public void seek(long newPosition)
seek
in interface FileDataInput
public int skipBytes(int n) throws java.io.IOException
DataInputPlus
skipBytes
in interface java.io.DataInput
skipBytes
in interface DataInputPlus
skipBytes
in class RebufferingInputStream
n
- number of bytes to skipjava.io.IOException
public 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.DataInput
readLine
in class RebufferingInputStream
null
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()
public static RandomAccessReader open(java.io.File file)
file
- File to open for readingCopyright © 2009- The Apache Software Foundation