Code example for FileChannel

Methods: read

0
	} 
 
	public int read() throws IOException { 
		if (!byteBuffer.hasRemaining()) {
			byteBuffer.clear();
			int count = fileChannel.read(byteBuffer);
			if (count < 0)
				return -1; 
			byteBuffer.position(0);
			byteBuffer.limit(count);
		} 
		offset++;
		return byteBuffer.get() & 0xff;
	} 
 
	public long getOffset() { 
		return offset;
	} 
 
	@Override 
	public void close() throws IOException {