Skip to content

@Bytes

@Bytes converts String instances into byte[] instances.

The annotation's charset attribute configures the charset to use for conversion. When not specified, the JVM default charset is used.

The following source types and target declarations are supported.

Source Type Target Declaration Example
String @Bytes byte[] "a"new byte[] { 97 }
String @Bytes(charset = "UTF-8") byte[] "ä"new byte[] { -61, -92 }