code: public synchronized void add(byte[] data, int offset, int count) throws IOException {
      if (data == null) {
        throw new NullPointerException("data == null");
      }
      if ((offset | count) < 0 || count > data.length - offset) {
        throw new IndexOutOfBoundsException();
      }
  
      expandIfNecessary(count);
  
      // Insert a new element after the current last element.
      boolean wasEmpty = isEmpty();
      int position =
          wasEmpty
              ? HEADER_LENGTH
              : wrapPosition(last.position + Element.HEADER_LENGTH + last.length);
      Element newLast = new Element(position, count);
  
      // Write length.
      writeInt(buffer, 0, count);
      ringWrite(newLast.position, buffer, 0, Element.HEADER_LENGTH);
  
      // Write data.
      ringWrite(newLast.position + Element.HEADER_LENGTH, data, offset, count);
  
      // Commit the addition. If wasEmpty, first == last.
      int firstPosition = wasEmpty ? newLast.position : first.position;
      writeHeader(fileLength, elementCount + 1, firstPosition, newLast.position);
      last = newLast;
      elementCount++;
      if (wasEmpty) first = last; // first element
    }
docs: Adds an element to the end of the queue.
  
  @param data to copy bytes from
  @param offset to start from in buffer
  @param count number of bytes to copy
  @throws IndexOutOfBoundsException if {@code offset < 0} or {@code count < 0}, or if {@code
  offset + count} is bigger than the length of {@code buffer}.