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 class
BCFile.Reader.BlockReader
Access 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 void
close()
Finishing reading the BCFile.int
getBlockCount()
Get the number of data blocks.BCFile.Reader.BlockReader
getDataBlock(int blockIndex)
Stream access to a Data Block.BCFile.Reader.BlockReader
getDataBlock(long offset, long compressedSize, long rawSize)
long
getDataBlockRawSize(int blockIndex)
BCFile.Reader.BlockReader
getMetaBlock(String name)
Stream access to a Meta Block.long
getMetaBlockRawSize(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:
close
in interfaceAutoCloseable
- Specified by:
close
in 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:
IOException
MetaBlockDoesNotExist
-
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)
-
-