public static void readFully(FileChannel channel,ByteBuffer dst) throws IOException {
  do {
    int r=channel.read(dst);
    if (r < 0) {
      throw new EOFException();
    }
  }
 while (dst.remaining() > 0);
}

public static void readFully ( FileChannel channel , ByteBuffer dst ) throws IOException { do { int r = channel . read ( dst ) ; if ( r < 0 ) { throw new EOFException ( ) ; } } while ( dst . remaining ( ) > 0 ) ; }
fully read from the file . this will read all remaining bytes , or throw an eofexception if not successful .
