code: public ChannelBuffer wrap(ByteBuffer buffer) {
          if (buffer == null) {
              throw new NullPointerException("buffer");
          }
  
          int position = buffer.position();
          int limit = buffer.limit();
  
          this.order = buffer.order();
          this.buffer = buffer;
          this.capacity = buffer.capacity();
          setIndex(position, limit);
          return this;
      }
docs: Creates a new buffer which wraps the specified buffer's slice.