黑马程序员技术交流社区
标题:
求大神讲解代码!!
[打印本页]
作者:
史柯
时间:
2015-8-26 16:17
标题:
求大神讲解代码!!
public class ByteArrayStreamDemo {
public static void main(String[] args) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (int x = 0; x < 10; x++) {
baos.write(("hello" + x).getBytes());
}
byte[] bys = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(bys);
int by = 0;
while ((by = bais.read()) != -1) {
System.out.print((char) by);
}
}
}
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2