code: public static final void write(WritableByteChannel ch, byte[] bytes, int offset, int length) throws IOException
      {
          ByteBuffer bb = ByteBuffer.allocate(length);
          bb.put(bytes, offset, length);
          bb.flip();
          writeAll(ch, bb);
      }
docs: Writes length bytes to channel starting at offset
  @param ch
  @param bytes
  @param offset
  @param length
  @throws IOException