code: protected void restore(BaseState state) {
      if (state.buffer != null) {
        this.buffer = state.buffer.clone();
        this.limit = state.buffer.length;
      }
      this.position = state.position;
      this.isOpen = state.isOpen;
      this.chunkSize = state.chunkSize;
    }
docs: Restores the state of the current write channel given a {@link BaseState} object.