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