docs: private static String encodeChunk(String value, FragmentType type, Charset charset) {
      byte[] data = value.getBytes(charset);
      ByteArrayOutputStream encoded = new ByteArrayOutputStream();
  
      for (byte b : data) {
        if (type.isAllowed(b)) {
          encoded.write(b);
        } else {
          /* percent encode the byte */
          pctEncode(b, encoded);
        }
      }
      return new String(encoded.toByteArray());
    }