format/src/main/java/com/github/sadikovi/riff/FileWriter.java
/**
   * Write internal row using this writer.
   * Row should confirm to the type description.
   * @param row internal row
   * @throws IOException
   */
Write internal row using this writer.
Row should confirm to the type description.
@param row internal row
@throws IOException
Write internal row using this writer . Row should confirm to the type description . @param row internal row @throws IOException
public void write(InternalRow row) throws IOException {
    try {
      if (stripeCurrentRecords == 0) {
        stripeStream.flush();
        StripeInformation stripeInfo =
          new StripeInformation(stripe, currentOffset, stripeStats, stripeFilters);
        currentOffset += stripeInfo.length();
        totalRecords += numRowsInStripe;
        stripe.flush(outputStream);
        LOG.debug("Finished writing stripe {}, records={}", stripeInfo, numRowsInStripe);
        stripes.add(stripeInfo);
        stripe = new StripeOutputBuffer(stripeId++);
        stripeStream = new OutStream(bufferSize, codec, stripe);
        stripeCurrentRecords = numRowsInStripe;
        stripeStats = createStatistics(td);
      }
      updateStatistics(stripeStats, td, row);
      updateColumnFilters(stripeFilters, td, row);
      recordWriter.writeRow(row, stripeStream);
      stripeCurrentRecords--;
    } catch (IOException ioe) {
      if (outputStream != null) {
        outputStream.close();
      }
      throw ioe;
    }
  }
public void write ( InternalRow row ) throws IOException { try { if ( stripeCurrentRecords == 0 ) { stripeStream . flush ( ) ; StripeInformation stripeInfo = new StripeInformation ( stripe , currentOffset , stripeStats , stripeFilters ) ; currentOffset += stripeInfo . length ( ) ; totalRecords += numRowsInStripe ; stripe . flush ( outputStream ) ; LOG . debug ( "Finished writing stripe {}, records={}" , stripeInfo , numRowsInStripe ) ; stripes . add ( stripeInfo ) ; stripe = new StripeOutputBuffer ( stripeId ++ ) ; stripeStream = new OutStream ( bufferSize , codec , stripe ) ; stripeCurrentRecords = numRowsInStripe ; stripeStats = createStatistics ( td ) ; } updateStatistics ( stripeStats , td , row ) ; updateColumnFilters ( stripeFilters , td , row ) ; recordWriter . writeRow ( row , stripeStream ) ; stripeCurrentRecords -- ; } catch ( IOException ioe ) { if ( outputStream != null ) { outputStream . close ( ) ; } throw ioe ; } }
Write internal row using this writer.
Write internal row using this writer .
// flush data into stripe buffer // write stripe information into output, such as stripe id and length, and capture position // written numRowsInStripe records