org.apache.cassandra.io.util
Class MappedFileDataInput
java.lang.Object
java.io.InputStream
org.apache.cassandra.io.util.AbstractDataInput
org.apache.cassandra.io.util.MappedFileDataInput
- All Implemented Interfaces:
- java.io.Closeable, java.io.DataInput, FileDataInput
public class MappedFileDataInput
- extends AbstractDataInput
- implements FileDataInput
Constructor Summary |
MappedFileDataInput(java.io.FileInputStream stream,
java.lang.String filename,
int position)
|
MappedFileDataInput(java.nio.MappedByteBuffer buffer,
java.lang.String filename,
int position)
|
Methods inherited from class org.apache.cassandra.io.util.AbstractDataInput |
readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF |
Methods inherited from class java.io.InputStream |
available, close, mark, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.io.DataInput |
readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF |
Methods inherited from interface java.io.Closeable |
close |
MappedFileDataInput
public MappedFileDataInput(java.io.FileInputStream stream,
java.lang.String filename,
int position)
throws java.io.IOException
- Throws:
java.io.IOException
MappedFileDataInput
public MappedFileDataInput(java.nio.MappedByteBuffer buffer,
java.lang.String filename,
int position)
seekInternal
protected void seekInternal(int pos)
- Specified by:
seekInternal
in class AbstractDataInput
getPosition
protected int getPosition()
- Specified by:
getPosition
in class AbstractDataInput
markSupported
public boolean markSupported()
- Overrides:
markSupported
in class java.io.InputStream
reset
public void reset(FileMark mark)
throws java.io.IOException
- Specified by:
reset
in interface FileDataInput
- Throws:
java.io.IOException
mark
public FileMark mark()
- Specified by:
mark
in interface FileDataInput
bytesPastMark
public long bytesPastMark(FileMark mark)
- Specified by:
bytesPastMark
in interface FileDataInput
isEOF
public boolean isEOF()
throws java.io.IOException
- Specified by:
isEOF
in interface FileDataInput
- Throws:
java.io.IOException
bytesRemaining
public long bytesRemaining()
throws java.io.IOException
- Specified by:
bytesRemaining
in interface FileDataInput
- Throws:
java.io.IOException
getPath
public java.lang.String getPath()
- Specified by:
getPath
in interface FileDataInput
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- Throws:
java.io.IOException
readBytes
public java.nio.ByteBuffer readBytes(int length)
throws java.io.IOException
- Does the same thing as
readFully
do but without copying data (thread safe)
- Specified by:
readBytes
in interface FileDataInput
- Parameters:
length
- length of the bytes to read
- Returns:
- buffer with portion of file content
- Throws:
java.io.IOException
- on any fail of I/O operation
readFully
public final void readFully(byte[] buffer)
throws java.io.IOException
- Description copied from class:
AbstractDataInput
- Reads bytes from this file into
buffer
. Blocks until buffer.length
number of bytes have been read, the end of the file is
reached or an exception is thrown.
- Specified by:
readFully
in interface java.io.DataInput
- Overrides:
readFully
in class AbstractDataInput
- Parameters:
buffer
- the buffer to read bytes into.
- Throws:
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.
readFully
public final void readFully(byte[] buffer,
int offset,
int count)
throws java.io.IOException
- Description copied from class:
AbstractDataInput
- Read bytes from this file into
buffer
starting at offset offset
. This method blocks until count
number of bytes have been
read.
- Specified by:
readFully
in interface java.io.DataInput
- Overrides:
readFully
in class AbstractDataInput
- Parameters:
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
.
- Throws:
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.
skipBytes
public int skipBytes(int n)
throws java.io.IOException
- Specified by:
skipBytes
in interface java.io.DataInput
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2011 The Apache Software Foundation