Code example for SocketChannel

Methods: read

   * Perform a nonblocking read into buffer. 
  public int read(ByteBuffer buffer) throws IOException {
   * Reads from the underlying input stream if not null. 
  public int read(byte[] buf, int off, int len) throws TTransportException {
    if ((socketChannel_.validOps() & SelectionKey.OP_READ) != SelectionKey.OP_READ) {
      throw new TTransportException(TTransportException.NOT_OPEN, 
        "Cannot read from write-only socket channel"); 
    try { 
      return, off, len));
    } catch (IOException iox) {
Stop searching for code, let great code find you!  Add Codota to your java IDE