List of utility methods to do String to Byte Array Convert
byte[] | toBytes(String hexString) Get the byte representation of an ASCII-HEX string. hexString = hexString.replace(" ", ""); if (hexString == null || hexString.length() % 2 != 0) { throw new RuntimeException( "Input string must contain an even number of characters"); char[] hex = hexString.toCharArray(); int length = hex.length / 2; byte[] raw = new byte[length]; ... |
byte[] | toBytes(String hexString) Get the byte representation of an ASCII-HEX string. if (hexString == null || hexString.length() % 2 != 0) { throw new RuntimeException( "Input string must contain an even number of characters"); char[] hex = hexString.toCharArray(); int length = hex.length / 2; byte[] raw = new byte[length]; for (int i = 0; i < length; i++) { ... |
byte[] | toBytes(String s) to Bytes return toBytes(s.toCharArray());
|
ByteString | stringToByteString(String string) string To Byte String return ByteString.copyFromUtf8(string);
|