Esempio n. 1
0
 /// <summary>Constructor</summary>
 /// <param name="register">the block register, which is called when the block is closed.
 ///     </param>
 /// <param name="wbs">The writable compression block state.</param>
 internal BlockAppender(Writer _enclosing, BCFile.Writer.BlockRegister register, BCFile.Writer.WBlockState
                        wbs)
     : base(wbs.GetOutputStream())
 {
     this._enclosing    = _enclosing;
     this.blockRegister = register;
     this.wBlkState     = wbs;
 }
Esempio n. 2
0
 /// <summary>
 /// Create a Data Block and obtain an output stream for adding data into the
 /// block.
 /// </summary>
 /// <remarks>
 /// 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.
 /// </remarks>
 /// <returns>The BlockAppender stream</returns>
 /// <exception cref="System.IO.IOException"/>
 public virtual BCFile.Writer.BlockAppender PrepareDataBlock()
 {
     if (blkInProgress == true)
     {
         throw new InvalidOperationException("Cannot create Data Block until previous block is closed."
                                             );
     }
     if (metaBlkSeen == true)
     {
         throw new InvalidOperationException("Cannot create Data Block after Meta Blocks."
                                             );
     }
     BCFile.Writer.DataBlockRegister dbr = new BCFile.Writer.DataBlockRegister(this);
     BCFile.Writer.WBlockState       wbs = new BCFile.Writer.WBlockState(GetDefaultCompressionAlgorithm
                                                                             (), @out, fsOutputBuffer, conf);
     BCFile.Writer.BlockAppender ba = new BCFile.Writer.BlockAppender(this, dbr, wbs);
     blkInProgress = true;
     return(ba);
 }
Esempio n. 3
0
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="Org.Apache.Hadoop.IO.File.Tfile.MetaBlockAlreadyExists"/>
 private BCFile.Writer.BlockAppender PrepareMetaBlock(string name, Compression.Algorithm
                                                      compressAlgo)
 {
     if (blkInProgress == true)
     {
         throw new InvalidOperationException("Cannot create Meta Block until previous block is closed."
                                             );
     }
     if (metaIndex.GetMetaByName(name) != null)
     {
         throw new MetaBlockAlreadyExists("name=" + name);
     }
     BCFile.Writer.MetaBlockRegister mbr = new BCFile.Writer.MetaBlockRegister(this, name
                                                                               , compressAlgo);
     BCFile.Writer.WBlockState wbs = new BCFile.Writer.WBlockState(compressAlgo, @out,
                                                                   fsOutputBuffer, conf);
     BCFile.Writer.BlockAppender ba = new BCFile.Writer.BlockAppender(this, mbr, wbs);
     blkInProgress = true;
     metaBlkSeen   = true;
     return(ba);
 }