question: protected void writeHeader ( RandomAccessFile file , int size ) throws IOException { String str ; int offset = 0 ; byte [ ] buffer = new byte [ 5 ] ; str = Integer . toString ( getSize ( ) ) ; for ( int i = 0 ; i < ( 5 - str . length ( ) ) ; i ++ ) { buffer [ i ] = ( byte ) '0' ; } offset += ( 5 - str . length ( ) ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { buffer [ i + offset ] = ( byte ) str . charAt ( i ) ; } file . write ( buffer ) ; }
target:  This is called by superclass when attempt to write data from file.