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(InputStreamType fin, long fileLength, org.apache.hadoop.conf.Configuration conf, AccumuloConfiguration accumuloConfiguration)
ConstructorReader(CachableBlockFile.Reader cache, InputStreamType fin, long fileLength, org.apache.hadoop.conf.Configuration conf, AccumuloConfiguration accumuloConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Finishing reading the BCFile.Utils.Version
getAPIVersion()
Get version of BCFile API.Utils.Version
getBCFileVersion()
Get version of BCFile file being read.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)
String
getDefaultCompressionName()
Get the name of the default compression algorithm.BCFile.Reader.BlockReader
getMetaBlock(String name)
Stream access to a Meta Block.
-
-
-
Constructor Detail
-
Reader
public Reader(InputStreamType fin, long fileLength, org.apache.hadoop.conf.Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException
Constructor- Parameters:
fin
- FS input stream.fileLength
- Length of the corresponding file- Throws:
IOException
-
Reader
public Reader(CachableBlockFile.Reader cache, InputStreamType fin, long fileLength, org.apache.hadoop.conf.Configuration conf, AccumuloConfiguration accumuloConfiguration) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getDefaultCompressionName
public String getDefaultCompressionName()
Get the name of the default compression algorithm.- Returns:
- the name of the default compression algorithm.
-
getBCFileVersion
public Utils.Version getBCFileVersion()
Get version of BCFile file being read.- Returns:
- version of BCFile file being read.
-
getAPIVersion
public Utils.Version getAPIVersion()
Get version of BCFile API.- Returns:
- version of BCFile API.
-
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
-
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
-
-