org.apache.accumulo.core.file.blockfile.impl
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, 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)).
Method Summary |
|
getIndex(Class<T> clazz)
|
int |
getPosition()
Get the file position. |
long |
getRawSize()
Size is the size of the bytearray that was read form the cache |
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 block |
void |
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.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 |
CachableBlockFile.BlockRead
public CachableBlockFile.BlockRead(InputStream in,
long size)
getRawSize
public long getRawSize()
- Size is the size of the bytearray that was read form the cache
- Specified by:
getRawSize
in interface ABlockReader
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 interface ABlockReader
- 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 interface ABlockReader
- Returns:
- true, if the block is indexable; otherwise false.
seek
public void seek(int position)
- Specified by:
seek
in interface ABlockReader
getPosition
public int getPosition()
- Description copied from interface:
ABlockReader
- Get the file position.
- Specified by:
getPosition
in interface ABlockReader
- Returns:
- the file position.
getIndex
public <T> T getIndex(Class<T> clazz)
- Specified by:
getIndex
in interface ABlockReader
Copyright © 2015 Apache Accumulo Project. All rights reserved.