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 classBCFile.Writer.BlockAppenderAccess point to stuff data into a block.
-
Constructor Summary
Constructors Constructor Description Writer(org.apache.hadoop.fs.FSDataOutputStream fout, RateLimiter writeLimiter, String compressionName, org.apache.hadoop.conf.Configuration conf, CryptoService cryptoService)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the BCFile Writer.longgetLength()BCFile.Writer.BlockAppenderprepareDataBlock()Create a Data Block and obtain an output stream for adding data into the block.BCFile.Writer.BlockAppenderprepareMetaBlock(String name)Create a Meta Block and obtain an output stream for adding data into the block.
-
-
-
Constructor Detail
-
Writer
public Writer(org.apache.hadoop.fs.FSDataOutputStream fout, RateLimiter writeLimiter, String compressionName, org.apache.hadoop.conf.Configuration conf, CryptoService cryptoService) throws IOExceptionConstructor- 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
-
getLength
public long getLength()
-
close
public void close() throws IOExceptionClose the BCFile Writer. Attempting to use the Writer after callingcloseis not allowed and may lead to undetermined results.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
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
-
-