문자열과 바이트 흐름이 서로 변환되다
454 단어 초록하다
public static void main(String[] args) throws IOException {
String a="babbabababbababababab";
byte[] buff = new byte[1024];
//
InputStream is = new ByteArrayInputStream(a.getBytes("utf-8"));
System.out.println(is);
int len = -1;
while(-1 != (len = is.read(buff))) {
//
String res = new String(buff, 0, len);
System.out.println(res);
}
}