Package io.deephaven.jdbc.util
Class ArrayParser
java.lang.Object
io.deephaven.jdbc.util.ArrayParser
A simple wrapper for string-to-array parsing. Parsers are kept in a cache per-delimiter so that we avoid recompiling
the pattern regex.
-
Method Summary
Modifier and TypeMethodDescriptionencodeArray
(double[] array) Convert the given array to a String.encodeArray
(long[] array) Convert the given array to a String.<T> T
Create a properly typed array from the input string based upon the delimiter, given a supplier.double[]
getDoubleArray
(String value, boolean strict) Parse the given string as an array of doubles, based upon the delimiter.static ArrayParser
getInstance
(String delimiter) long[]
getLongArray
(String value, boolean strict) Parse the given string as an array of longs, based upon the delimiter.
-
Method Details
-
getInstance
-
getDoubleArray
Parse the given string as an array of doubles, based upon the delimiter.- Parameters:
value
- string to parsestrict
- fail if the pattern does not begin / end with: [], {}, or ()- Returns:
- array of parsed values
-
getLongArray
Parse the given string as an array of longs, based upon the delimiter.- Parameters:
value
- string the to parsestrict
- fail if the pattern does not begin / end with: [], {}, or ()- Returns:
- array of parsed values
-
getArray
Create a properly typed array from the input string based upon the delimiter, given a supplier.- Type Parameters:
T
- the type- Parameters:
value
- The array string valuestrict
- fail if the pattern does not begin / end with: [], {}, or ()elementSupplier
- a supplier to convert a stream of element strings to items of the correct types- Returns:
- an array of values of the specified type
-
encodeArray
Convert the given array to a String.- Parameters:
array
- the array- Returns:
- array encoded as string
-
encodeArray
Convert the given array to a String.- Parameters:
array
- the array- Returns:
- array encoded as string
-