code: public Buffers copy() {
          for(int i=Math.max(position, next_to_copy); i < limit; i++) {
              this.bufs[i]=copyBuffer(this.bufs[i]);
              next_to_copy=(short)(i+1);
          }
          return this;
      }
docs: Copies the data that has not yet been written and moves last_copied. Typically done after an unsuccessful
  write, if copying is required. This is typically needed if the output buffer is reused. Note that
  direct buffers will be converted to heap-based buffers