Java examples for java.nio.channels:FileChannel
read Bytes from FileChannel
//package com.java2s; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class Main { public static byte[] readBytes(int offset, FileChannel fc, ByteBuffer buffer) throws IOException { fc.position(offset);/*from w w w. j a v a 2 s . c o m*/ buffer.clear(); fc.read(buffer); return buffer.array(); } }