code: public static Packet build(IoBuffer buffer) {
          if (buffer.hasArray()) {
              return new Packet(buffer.array());
          }
          byte[] buf = new byte[buffer.remaining()];
          buffer.get(buf);
          return new Packet(buf);
      }
docs: Builds the packet which just wraps the IoBuffer.
  
  @param buffer
  @return packet