Class CachableBlockFile.BlockRead
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.io.DataInputStream
-
- org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile.BlockRead
-
- All Implemented Interfaces:
Closeable
,DataInput
,AutoCloseable
,ABlockReader
- Direct Known Subclasses:
CachableBlockFile.CachedBlockRead
- Enclosing class:
- CachableBlockFile
public static class CachableBlockFile.BlockRead extends DataInputStream implements ABlockReader
Class provides functionality to read one block from the underlying BCFile Since We are caching blocks in the Reader class as bytearrays, this class will wrap a DataInputStream(ByteArrayStream(cachedBlock)).
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description BlockRead(InputStream in, long size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getBuffer()
The byte array returned by this method is only for read optimizations, it should not be modified.<T> T
getIndex(Class<T> clazz)
int
getPosition()
Get the file position.DataInputStream
getStream()
It is intended that the caller of this method will close the stream we also only intend that this be called once per BlockRead.boolean
isIndexable()
An indexable block supports seeking, getting a position, and associating an arbitrary index with the blockvoid
seek(int position)
-
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.accumulo.core.file.blockfile.ABlockReader
close
-
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
-
-
-
Constructor Detail
-
BlockRead
public BlockRead(InputStream in, long size)
-
-
Method Detail
-
getStream
public DataInputStream getStream() throws IOException
It is intended that the caller of this method will close the stream we also only intend that this be called once per BlockRead. This method is provide for methods up stream that expect to receive a DataInputStream object.- Specified by:
getStream
in interfaceABlockReader
- Throws:
IOException
-
isIndexable
public boolean isIndexable()
Description copied from interface:ABlockReader
An indexable block supports seeking, getting a position, and associating an arbitrary index with the block- Specified by:
isIndexable
in interfaceABlockReader
- Returns:
- true, if the block is indexable; otherwise false.
-
seek
public void seek(int position)
- Specified by:
seek
in interfaceABlockReader
-
getPosition
public int getPosition()
Description copied from interface:ABlockReader
Get the file position.- Specified by:
getPosition
in interfaceABlockReader
- Returns:
- the file position.
-
getIndex
public <T> T getIndex(Class<T> clazz)
- Specified by:
getIndex
in interfaceABlockReader
-
getBuffer
public byte[] getBuffer()
The byte array returned by this method is only for read optimizations, it should not be modified.- Specified by:
getBuffer
in interfaceABlockReader
-
-