public class MappedFileDataInput extends AbstractDataInput implements FileDataInput
Constructor and Description |
---|
MappedFileDataInput(java.io.FileInputStream stream,
java.lang.String filename,
long segmentOffset,
int position) |
MappedFileDataInput(java.nio.MappedByteBuffer buffer,
java.lang.String filename,
long segmentOffset,
int position) |
Modifier and Type | Method and Description |
---|---|
long |
bytesPastMark(FileMark mark) |
long |
bytesRemaining() |
long |
getFilePointer() |
java.lang.String |
getPath() |
protected int |
getPosition() |
boolean |
isEOF() |
FileMark |
mark() |
boolean |
markSupported() |
int |
read() |
java.nio.ByteBuffer |
readBytes(int length)
Does the same thing as
readFully do but without copying data (thread safe) |
void |
readFully(byte[] buffer)
Reads bytes from this file into
buffer . |
void |
readFully(byte[] buffer,
int offset,
int count)
Read bytes from this file into
buffer starting at offset offset . |
void |
reset(FileMark mark) |
void |
seek(long pos) |
protected void |
seekInternal(int pos) |
int |
skipBytes(int n) |
java.lang.String |
toString() |
readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public MappedFileDataInput(java.io.FileInputStream stream, java.lang.String filename, long segmentOffset, int position) throws java.io.IOException
java.io.IOException
public MappedFileDataInput(java.nio.MappedByteBuffer buffer, java.lang.String filename, long segmentOffset, int position)
protected void seekInternal(int pos)
seekInternal
in class AbstractDataInput
public void seek(long pos) throws java.io.IOException
seek
in interface FileDataInput
java.io.IOException
public long getFilePointer()
getFilePointer
in interface FileDataInput
protected int getPosition()
getPosition
in class AbstractDataInput
public boolean markSupported()
markSupported
in class java.io.InputStream
public void reset(FileMark mark) throws java.io.IOException
reset
in interface FileDataInput
java.io.IOException
public FileMark mark()
mark
in interface FileDataInput
public long bytesPastMark(FileMark mark)
bytesPastMark
in interface FileDataInput
public boolean isEOF() throws java.io.IOException
isEOF
in interface FileDataInput
java.io.IOException
public long bytesRemaining() throws java.io.IOException
bytesRemaining
in interface FileDataInput
java.io.IOException
public java.lang.String getPath()
getPath
in interface FileDataInput
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public java.nio.ByteBuffer readBytes(int length) throws java.io.IOException
readFully
do but without copying data (thread safe)readBytes
in interface FileDataInput
length
- length of the bytes to readjava.io.IOException
- on any fail of I/O operationpublic final void readFully(byte[] buffer) throws java.io.IOException
AbstractDataInput
buffer
. Blocks until buffer.length
number of bytes have been read, the end of the file is
reached or an exception is thrown.readFully
in interface java.io.DataInput
readFully
in class AbstractDataInput
buffer
- the buffer to read bytes into.java.io.EOFException
- if the end of this file is detected.java.io.IOException
- if this file is closed or another I/O error occurs.public final void readFully(byte[] buffer, int offset, int count) throws java.io.IOException
AbstractDataInput
buffer
starting at offset offset
. This method blocks until count
number of bytes have been
read.readFully
in interface java.io.DataInput
readFully
in class AbstractDataInput
buffer
- the buffer to read bytes into.offset
- the initial position in buffer
to store the bytes read
from this file.count
- the maximum number of bytes to store in buffer
.java.io.EOFException
- if the end of this file is detected.java.io.IOException
- if this file is closed or another I/O error occurs.public int skipBytes(int n) throws java.io.IOException
skipBytes
in interface java.io.DataInput
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2013 The Apache Software Foundation