java 数组流

java 数组流

Example10_10.java

import java.io.*;
public class Example10_10 {
public static void main(String args[]) {
try {
ByteArrayOutputStream outByte=new ByteArrayOutputStream();
byte [] byteContent="mid-autumn festival".getBytes();
outByte.write(byteContent);
ByteArrayInputStream inByte=new ByteArrayInputStream(outByte.toByteArray());
byte backByte []=new byte[outByte.toByteArray().length];
inByte.read(backByte);
System.out.println(new String(backByte));
CharArrayWriter outChar=new CharArrayWriter();
char [] charContent="中秋快乐".toCharArray();
outChar.write(charContent);
CharArrayReader inChar=new CharArrayReader(outChar.toCharArray());
char backChar []=new char[outChar.toCharArray().length];
inChar.read(backChar);
System.out.println(new String(backChar));
}
catch(IOException exp){}
}
}
上一篇:开源RPC(gRPC/Thrift)框架性能评测


下一篇:sqlalchemy在pythonweb中开发的使用(基于tornado的基础上)