ToBytes
See javadoc - uk.gov.gchq.koryphe.impl.function.ToBytes
Available since Koryphe version 1.8.0
Extracts the bytes from a string
Examples
String to bytes
Java
JSON
Full JSON
Python
final ToBytes toBytes = new ToBytes(StandardCharsets.UTF_16);
{
"class" : "ToBytes",
"charset" : "UTF-16"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.ToBytes",
"charset" : "UTF-16"
}
g.ToBytes(
charset="UTF-16"
)
Input type:
java.lang.String
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.String | example String | byte[] | �� e x a m p l e S t r i n g |
java.lang.String | byte[] | ||
null | null | ||
java.lang.Integer | 1 | ClassCastException: java.lang.Integer cannot be cast to java.lang.String |