public static int readInts(final File f,final int fileOffset,final int fileEnd,final CommonIndex a,final long offset,final long addend) throws IOException {
  final int length=(fileEnd - fileOffset) * 4;
  final byte[] b=new byte[length];
  try (InputStream stream=new FileInputStream(f)){
    int remaining=fileOffset * 4;
    long skipped;
    while (remaining > 0 && (skipped=FileUtils.streamSkip(stream,remaining)) > 0) {
      remaining-=(int)skipped;
    }
    if (remaining > 0) {
      throw new IOException();
    }
    int soFar=0;
    int read;
    while (soFar < length && (read=stream.read(b,soFar,length - soFar)) > 0) {
      soFar+=read;
    }
    if (soFar < length) {
      throw new IOException();
    }
  }
   for (int i=0; i < b.length; i+=4) {
    a.set(offset + i / 4,ByteArrayIOUtils.bytesToIntBigEndian(b,i) + addend);
  }
  return b.length / 4;
}

public static int readInts ( final File f , final int fileOffset , final int fileEnd , final CommonIndex a , final long offset , final long addend ) throws IOException { final int length = ( fileEnd - fileOffset ) * 4 ; final byte [ ] b = new byte [ length ] ; try ( InputStream stream = new FileInputStream ( f ) ) { int remaining = fileOffset * 4 ; long skipped ; while ( remaining > 0 && ( skipped = FileUtils . streamSkip ( stream , remaining ) ) > 0 ) { remaining -= ( int ) skipped ; } if ( remaining > 0 ) { throw new IOException ( ) ; } int soFar = 0 ; int read ; while ( soFar < length && ( read = stream . read ( b , soFar , length - soFar ) ) > 0 ) { soFar += read ; } if ( soFar < length ) { throw new IOException ( ) ; } } for ( int i = 0 ; i < b . length ; i += 4 ) { a . set ( offset + i / 4 , ByteArrayIOUtils . bytesToIntBigEndian ( b , i ) + addend ) ; } return b . length / 4 ; }
read an array of longs from a file .
