private List < OrcDataOutput > bufferFileFooter ( ) throws IOException { List < OrcDataOutput > outputData = new ArrayList <> ( ) ; Metadata metadata = new Metadata ( closedStripes . stream ( ) . map ( ClosedStripe :: getStatistics ) . collect ( toList ( ) ) ) ; Slice metadataSlice = metadataWriter . writeMetadata ( metadata ) ; outputData . add ( createDataOutput ( metadataSlice ) ) ; long numberOfRows = closedStripes . stream ( ) . mapToLong ( stripe -> stripe . getStripeInformation ( ) . getNumberOfRows ( ) ) . sum ( ) ; List < ColumnStatistics > fileStats = toFileStats ( closedStripes . stream ( ) . map ( ClosedStripe :: getStatistics ) . map ( StripeStatistics :: getColumnStatistics ) . collect ( toList ( ) ) ) ; recordValidation ( validation -> validation . setFileStatistics ( fileStats ) ) ; Map < String , Slice > userMetadata = this . userMetadata . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Entry :: getKey , entry -> utf8Slice ( entry . getValue ( ) ) ) ) ; Footer footer = new Footer ( numberOfRows , rowGroupMaxRowCount , closedStripes . stream ( ) . map ( ClosedStripe :: getStripeInformation ) . collect ( toList ( ) ) , orcTypes , fileStats , userMetadata ) ; closedStripes . clear ( ) ; closedStripesRetainedBytes = 0 ; Slice footerSlice = metadataWriter . writeFooter ( footer ) ; outputData . add ( createDataOutput ( footerSlice ) ) ; recordValidation ( validation -> validation . setVersion ( metadataWriter . getOrcMetadataVersion ( ) ) ) ; Slice postscriptSlice = metadataWriter . writePostscript ( footerSlice . length ( ) , metadataSlice . length ( ) , compression , maxCompressionBufferSize ) ; outputData . add ( createDataOutput ( postscriptSlice ) ) ; outputData . add ( createDataOutput ( Slices . wrappedBuffer ( ( byte ) postscriptSlice . length ( ) ) ) ) ; return outputData ; }
Collect the data for for the file footer . This is not the actual data but instead are functions that know how to write the data .