format/src/main/java/com/github/sadikovi/riff/FileFooter.java
/**
   * Write footer into output stream.
   * Stream is not closed after this operation is complete.
   * @param out output stream
   * @throws IOException
   */
Write footer into output stream.
Stream is not closed after this operation is complete.
@param out output stream
@throws IOException
Write footer into output stream . Stream is not closed after this operation is complete . @param out output stream @throws IOException
public void writeTo(FSDataOutputStream out) throws IOException {
    OutputBuffer buffer = new OutputBuffer();
    buffer.writeLong(numRecords);
    buffer.writeInt(fileStats.length);
    int i = 0;
    while (i < fileStats.length) {
      LOG.debug("Write file statistics {}", fileStats[i]);
      fileStats[i++].writeExternal(buffer);
    }
    prepareStripeInformation();
    LOG.debug("Write {} stripes", stripes.length);
    buffer.writeInt(stripes.length);
    i = 0;
    while (i < stripes.length) {
      stripes[i++].writeExternal(buffer);
    }
    buffer.align();
    buffer.writeLong(((long) Riff.MAGIC << 32) + buffer.bytesWritten());
    LOG.debug("Write footer content of {} bytes", buffer.bytesWritten());
    buffer.writeExternal(out);
  }
public void writeTo ( FSDataOutputStream out ) throws IOException { OutputBuffer buffer = new OutputBuffer ( ) ; buffer . writeLong ( numRecords ) ; buffer . writeInt ( fileStats . length ) ; int i = 0 ; while ( i < fileStats . length ) { LOG . debug ( "Write file statistics {}" , fileStats [ i ] ) ; fileStats [ i ++ ] . writeExternal ( buffer ) ; } prepareStripeInformation ( ) ; LOG . debug ( "Write {} stripes" , stripes . length ) ; buffer . writeInt ( stripes . length ) ; i = 0 ; while ( i < stripes . length ) { stripes [ i ++ ] . writeExternal ( buffer ) ; } buffer . align ( ) ; buffer . writeLong ( ( ( long ) Riff . MAGIC << 32 ) + buffer . bytesWritten ( ) ) ; LOG . debug ( "Write footer content of {} bytes" , buffer . bytesWritten ( ) ) ; buffer . writeExternal ( out ) ; }
Write footer into output stream.
Write footer into output stream .
// write file metadata and number of records in file // when we save stripes they contain relative offset to the first stripe, when reading each // stripe, we would correct on current stream position. // align first // magic and number of bytes to read should be written the last in the stream // write buffer data