code: public void toByteArray(byte[] toBuf, int offset) {
          int toLen = (toBuf.length > count) ? count : toBuf.length;
          System.arraycopy(buf, offset, toBuf, offset, toLen - offset);
      }
docs: Copy the buffered data to the given array.
  
  @param toBuf  the buffer to hold a copy of the data.
  @param offset the offset at which to start copying.