@ Override public long readLong ( ) throws IOException { byte [ ] longBytes = new byte [ 8 ] ; int i = in . read ( longBytes ) ; if ( i < 8 ) { throw new EOFException ( ) ; } longBytes [ 0 ] = ( byte ) ( longBytes [ 0 ] ^ 0x80 ) ; long value = 0 ; for ( int j = 0 ; j < longBytes . length ; ++ j ) { value = ( value << 8 ) + ( longBytes [ j ] & 0xff ) ; } return value ; }
A long was written by flipping the sign bit and writing it as a big endian long .