java.lang.Object
io.helidon.common.http.Utils
Internal utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
toByteArray
(ByteBuffer byteBuffer) Convert the given byte buffer to a byte array.Tokenize providetext
byseparator
char respecting quoted sub-sequences.static String
Unwrap from double-quotes - if exists.static void
write
(ByteBuffer byteBuffer, OutputStream out) Appends the content of the given byte buffer into the given output stream.
-
Method Details
-
tokenize
public static List<String> tokenize(char separator, String quoteChars, boolean includeEmptyTokens, String text) Tokenize providetext
byseparator
char respecting quoted sub-sequences. Quoted sub-sequences are parts oftext
which starts and ends by the samequoteChar
.- 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 withlength == 0
.text
- a text to be tokenized.- Returns:
- A list of tokens without separator characters.
-
unwrap
Unwrap from double-quotes - if exists.- Parameters:
str
- string to unwrap.- Returns:
- unwrapped string.
-
write
Appends the content of the given byte buffer into the given output stream.- Parameters:
out
- the stream where to append the byte bufferbyteBuffer
- the byte buffer to append to the stream- Throws:
IOException
- in case of an IO problem
-
toByteArray
Convert the given byte buffer to a byte array.- Parameters:
byteBuffer
- byte buffer- Returns:
- byte array
-