private void flushBlock ( ) throws IOException { if ( this . debug ) { System . err . println ( "TarBuffer.flushBlock() called." ) ; } if ( this . outStream == null ) { throw new IOException ( "writing to an input buffer" ) ; } // Thanks to 'Todd Kofford <tkofford@bigfoot.com>' for this patch. // Use a buffer initialized with 0s to initialize everything in the // blockBuffer after the last current, complete record. This prevents // any previous data that might have previously existed in the // blockBuffer from being written to the file. if ( this . currRecIdx > 0 ) { int offset = this . currRecIdx * this . recordSize ; byte [ ] zeroBuffer = new byte [ this . blockSize - offset ] ; System . arraycopy ( zeroBuffer , 0 , this . blockBuffer , offset , zeroBuffer . length ) ; this . writeBlock ( ) ; } }
Flush the current data block if it has any data in it .