code: public boolean startsWith(byte[] prefix) {
          if ((prefix.length == 0) || (prefix.length > size())) {
              // no match would be possible
              return false;
          }
          boolean match = true;
          int i = 0;
          int j = this.currentReadPosition;
          while (match && (i < prefix.length)) {
              if (this.buffer[j] != prefix[i]) {
                  match = false;
              }
              i++;
              j = (j + 1) % this.buffer.length;
          }
          return match;
      }
docs: Tests if the buffer starts with the byte array prefix. The byte array
  prefix must have a size >= this buffer's size.
  @return True if the buffer starts with the bytes array, otherwise false.