Class BCFile.Writer
- java.lang.Object
-
- org.apache.accumulo.core.file.rfile.bcfile.BCFile.Writer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Enclosing class:
- BCFile
public static class BCFile.Writer extends Object implements Closeable
BCFile writer, the entry point for creating a new BCFile.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BCFile.Writer.BlockAppender
Access point to stuff data into a block.
-
Constructor Summary
Constructors Constructor Description Writer(OutputStreamType fout, String compressionName, org.apache.hadoop.conf.Configuration conf, boolean trackDataBlocks, AccumuloConfiguration accumuloConfiguration)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the BCFile Writer.BCFile.Writer.BlockAppender
prepareDataBlock()
Create a Data Block and obtain an output stream for adding data into the block.BCFile.Writer.BlockAppender
prepareMetaBlock(String name)
Create a Meta Block and obtain an output stream for adding data into the block.BCFile.Writer.BlockAppender
prepareMetaBlock(String name, String compressionName)
Create a Meta Block and obtain an output stream for adding data into the block.
-
-
-
Constructor Detail
-
Writer
public Writer(OutputStreamType fout, String compressionName, org.apache.hadoop.conf.Configuration conf, boolean trackDataBlocks, AccumuloConfiguration accumuloConfiguration) throws IOException
Constructor- Parameters:
fout
- FS output stream.compressionName
- Name of the compression algorithm, which will be used for all data blocks.- Throws:
IOException
- See Also:
Compression.getSupportedAlgorithms()
-
-
Method Detail
-
close
public void close() throws IOException
Close the BCFile Writer. Attempting to use the Writer after callingclose
is not allowed and may lead to undetermined results.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
prepareMetaBlock
public BCFile.Writer.BlockAppender prepareMetaBlock(String name, String compressionName) throws IOException, MetaBlockAlreadyExists
Create a Meta Block and obtain an output stream for adding data into the block. There can only be one BlockAppender stream active at any time. Regular Blocks may not be created after the first Meta Blocks. The caller must call BlockAppender.close() to conclude the block creation.- Parameters:
name
- The name of the Meta Block. The name must not conflict with existing Meta Blocks.compressionName
- The name of the compression algorithm to be used.- Returns:
- The BlockAppender stream
- Throws:
MetaBlockAlreadyExists
- If the meta block with the name already exists.IOException
-
prepareMetaBlock
public BCFile.Writer.BlockAppender prepareMetaBlock(String name) throws IOException, MetaBlockAlreadyExists
Create a Meta Block and obtain an output stream for adding data into the block. The Meta Block will be compressed with the same compression algorithm as data blocks. There can only be one BlockAppender stream active at any time. Regular Blocks may not be created after the first Meta Blocks. The caller must call BlockAppender.close() to conclude the block creation.- Parameters:
name
- The name of the Meta Block. The name must not conflict with existing Meta Blocks.- Returns:
- The BlockAppender stream
- Throws:
MetaBlockAlreadyExists
- If the meta block with the name already exists.IOException
-
prepareDataBlock
public BCFile.Writer.BlockAppender prepareDataBlock() throws IOException
Create a Data Block and obtain an output stream for adding data into the block. There can only be one BlockAppender stream active at any time. Data Blocks may not be created after the first Meta Blocks. The caller must call BlockAppender.close() to conclude the block creation.- Returns:
- The BlockAppender stream
- Throws:
IOException
-
-