private ByteBuffer readHeader ( RandomAccessFile ds ) throws IOException { /* * the first byte defines the number of bytes are used to describe the row addresses in the * header (once it was sizeof(long) in grass but then it was turned to an offset (that * brought to reading problems in JGrass whenever the offset was != 4). */ int first = ds . read ( ) ; ByteBuffer fileHeader = ByteBuffer . allocate ( 1 + first * fileWindow . getRows ( ) + first ) ; ds . seek ( 0 ) ; /* Read header */ ds . read ( fileHeader . array ( ) ) ; return fileHeader ; }
Reads the header part of the file into memory