Java ByteBuffer Read c_read(Channel fd, ByteBuffer buffer, int count)

Here you can find the source of c_read(Channel fd, ByteBuffer buffer, int count)

Description

read

License

Open Source License

Declaration

public static int c_read(Channel fd, ByteBuffer buffer, int count) 

Method Source Code

//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;
        }
    }
}

Related

  1. assertReadyForFreshRead(ByteBuffer b)
  2. checkNotReadOnly(ByteBuffer buffer)
  3. contentOfUnreadBuffer(final ByteBuffer buffer)
  4. enlargeThreadLocalByteBuffer()
  5. parseEsInfo(ByteBuffer read)