org.apache.accumulo.core.file.rfile.bcfile
Class BCFile.Writer

java.lang.Object
  extended by org.apache.accumulo.core.file.rfile.bcfile.BCFile.Writer
All Implemented Interfaces:
Closeable
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
 class BCFile.Writer.BlockAppender
          Access point to stuff data into a block.
 
Constructor Summary
BCFile.Writer(org.apache.hadoop.fs.FSDataOutputStream fout, String compressionName, org.apache.hadoop.conf.Configuration conf, boolean trackDataBlocks)
          Constructor
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BCFile.Writer

public BCFile.Writer(org.apache.hadoop.fs.FSDataOutputStream fout,
                     String compressionName,
                     org.apache.hadoop.conf.Configuration conf,
                     boolean trackDataBlocks)
              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 calling close is not allowed and may lead to undetermined results.

Specified by:
close in interface Closeable
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:
IOException
MetaBlockAlreadyExists - If the meta block with the name already exists.

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


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.