前提
部分数据存储或者转换为字节(通过getBytes方法)后,一般获取出来的都是字节数组的数据形式
转化
使用string构造方法,注意导包路径(这里使用UTF-8做示例)
string为java.lang包下,不是其他的同名String.
// StandardCharsets来源
package java.nio.charset;
bytes[] columnMapping = xxxxxxxxx;
String columnMappingStr = new String(columnMapping, StandardCharsets.UTF_8);
字符串转 bytes[]
"xxxxxxx".getBytes()
// 或 可以指定编码
"xxxxxxx".getBytes(StandardCharsets.UTF_8)