code: protected void read(ReadableByteChannel channel, ByteBuffer bb, int expected, String message) throws IOException {
          int len = channel.read(bb);
          if (len != expected) {
              throw new IOException(message);
          }
      }
docs: Reads from the specified <code>channel</code>
  
  @param channel  - the readable channel
  @param bb       - the byte buffer to write
  @param expected - the number of bytes expected to read
  @param message  - the IOException message
  @throws IOException