@ Override public void write ( byte [ ] record ) throws IOException { Preconditions . checkNotNull ( record ) ; byte [ ] toWrite = record ; if ( this . recordDelimiter . isPresent ( ) ) { toWrite = Arrays . copyOf ( record , record . length + 1 ) ; toWrite [ toWrite . length - 1 ] = this . recordDelimiter . get ( ) ; } if ( this . prependSize ) { long recordSize = toWrite . length ; ByteBuffer buf = ByteBuffer . allocate ( Longs . BYTES ) ; buf . putLong ( recordSize ) ; toWrite = ArrayUtils . addAll ( buf . array ( ) , toWrite ) ; } this . stagingFileOutputStream . write ( toWrite ) ; this . bytesWritten += toWrite . length ; this . recordsWritten ++ ; }
Write a source record to the staging file