private boolean createEmptyHeader ( String filePath , int rows ) { try { RandomAccessFile theCreatedFile = new RandomAccessFile ( filePath , "rw" ) ; rowaddresses = new long [ rows + 1 ] ; // the size of a long theCreatedFile . write ( 4 ) ; // write the addresses of the row begins. Since we don't know how // much // they will be compressed, they will be filled after the // compression for ( int i = 0 ; i < rows + 1 ; i ++ ) { theCreatedFile . writeInt ( 0 ) ; } pointerInFilePosition = theCreatedFile . getFilePointer ( ) ; rowaddresses [ 0 ] = pointerInFilePosition ; theCreatedFile . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return false ; } return true ; }
creates the space for the header of the rasterfile filling the spaces with zeroes . After the compression the values will be rewritten