Exemplo n.º 1
0
    /**
     * reads from the socket and writes them to the buffer
     *
     * @param socketChannel the socketChannel to read from
     * @return the number of bytes read
     * @throws IOException
     */
    private int readSocketToBuffer(@NotNull final SocketChannel socketChannel) throws IOException {

      compactBuffer();
      final int len = socketChannel.read(in);
      out.limit(in.position());
      return len;
    }