Class Utils

java.lang.Object
io.helidon.common.http.Utils

public final class Utils extends Object
Internal utility methods.
  • Method Details

    • tokenize

      public static List<String> tokenize(char separator, String quoteChars, boolean includeEmptyTokens, String text)
      Tokenize provide text by separator char respecting quoted sub-sequences. Quoted sub-sequences are parts of text which starts and ends by the same quoteChar.
      Parameters:
      separator - a token separator.
      quoteChars - characters which can be used for quoting. Quoted part must start and ends with the same character.
      includeEmptyTokens - return also tokens with length == 0.
      text - a text to be tokenized.
      Returns:
      A list of tokens without separator characters.
    • unwrap

      public static String unwrap(String str)
      Unwrap from double-quotes - if exists.
      Parameters:
      str - string to unwrap.
      Returns:
      unwrapped string.
    • write

      public static void write(ByteBuffer byteBuffer, OutputStream out) throws IOException
      Appends the content of the given byte buffer into the given output stream.
      Parameters:
      out - the stream where to append the byte buffer
      byteBuffer - the byte buffer to append to the stream
      Throws:
      IOException - in case of an IO problem
    • toByteArray

      public static byte[] toByteArray(ByteBuffer byteBuffer)
      Convert the given byte buffer to a byte array.
      Parameters:
      byteBuffer - byte buffer
      Returns:
      byte array