Class BCFile.Reader
- java.lang.Object
-
- org.apache.accumulo.core.file.rfile.bcfile.BCFile.Reader
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- BCFile
public static class BCFile.Reader extends Object implements Closeable
BCFile Reader, interface to read the file's data and meta blocks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBCFile.Reader.BlockReaderAccess point to read a block.
-
Constructor Summary
Constructors Constructor Description Reader(byte[] serializedMetadata, InputStreamType fin, org.apache.hadoop.conf.Configuration conf, CryptoService cryptoService)Reader(InputStreamType fin, long fileLength, org.apache.hadoop.conf.Configuration conf, CryptoService cryptoService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Finishing reading the BCFile.intgetBlockCount()Get the number of data blocks.BCFile.Reader.BlockReadergetDataBlock(int blockIndex)Stream access to a Data Block.BCFile.Reader.BlockReadergetDataBlock(long offset, long compressedSize, long rawSize)longgetDataBlockRawSize(int blockIndex)BCFile.Reader.BlockReadergetMetaBlock(String name)Stream access to a Meta Block.longgetMetaBlockRawSize(String name)byte[]serializeMetadata(int maxSize)
-
-
-
Constructor Detail
-
Reader
public Reader(InputStreamType fin, long fileLength, org.apache.hadoop.conf.Configuration conf, CryptoService cryptoService) throws IOException- Throws:
IOException
-
Reader
public Reader(byte[] serializedMetadata, InputStreamType fin, org.apache.hadoop.conf.Configuration conf, CryptoService cryptoService) throws IOException- Throws:
IOException
-
-
Method Detail
-
serializeMetadata
public byte[] serializeMetadata(int maxSize)
-
close
public void close()
Finishing reading the BCFile. Release all resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getBlockCount
public int getBlockCount()
Get the number of data blocks.- Returns:
- the number of data blocks.
-
getMetaBlock
public BCFile.Reader.BlockReader getMetaBlock(String name) throws IOException, MetaBlockDoesNotExist
Stream access to a Meta Block.- Parameters:
name- meta block name- Returns:
- BlockReader input stream for reading the meta block.
- Throws:
MetaBlockDoesNotExist- The Meta Block with the given name does not exist.IOException
-
getMetaBlockRawSize
public long getMetaBlockRawSize(String name) throws IOException, MetaBlockDoesNotExist
- Throws:
IOExceptionMetaBlockDoesNotExist
-
getDataBlock
public BCFile.Reader.BlockReader getDataBlock(int blockIndex) throws IOException
Stream access to a Data Block.- Parameters:
blockIndex- 0-based data block index.- Returns:
- BlockReader input stream for reading the data block.
- Throws:
IOException
-
getDataBlock
public BCFile.Reader.BlockReader getDataBlock(long offset, long compressedSize, long rawSize) throws IOException
- Throws:
IOException
-
getDataBlockRawSize
public long getDataBlockRawSize(int blockIndex)
-
-