public static void readFromFileChannelWithEofException(FileChannel channel,long channelPosition,ByteBuffer dest) throws IOException {
  int read=readFromFileChannel(channel,channelPosition,dest);
  if (read < 0) {
    throw new EOFException("read past EOF. pos [" + channelPosition + "] length: ["+ dest.limit()+ "] end: ["+ channel.size()+ "]");
  }
}

public static void readFromFileChannelWithEofException ( FileChannel channel , long channelPosition , ByteBuffer dest ) throws IOException { int read = readFromFileChannel ( channel , channelPosition , dest ) ; if ( read < 0 ) { throw new EOFException ( "read past EOF. pos [" + channelPosition + "] length: [" + dest . limit ( ) + "] end: [" + channel . size ( ) + "]" ) ; } }
read from a file channel into a byte buffer , starting at a certain position . an eofexception will be thrown if you attempt to read beyond the end of file .
