Here you can find the source of c_read(Channel fd, ByteBuffer buffer, int count)
public static int c_read(Channel fd, ByteBuffer buffer, int count)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.nio.channels.Channel; import java.nio.channels.ReadableByteChannel; public class Main { public static int c_read(Channel fd, ByteBuffer buffer, int count) { try {/* ww w .j a v a 2 s .co m*/ ReadableByteChannel rc = (ReadableByteChannel) fd; buffer = buffer.duplicate(); buffer.limit(buffer.position() + count); return rc.read(buffer); } catch (Exception e) { e.printStackTrace(); return -1; } } }