package demo.io;
import java.io.*;
class 字节数组流ByteArrayInputStream和ByteArrayOutputStream {
public static void main(String[] args) throws IOException {
output();
}
private static void input() {
byte[] buf = {97, 98, 99, 100};
ByteArrayInputStream bis = new ByteArrayInputStream(buf);
int ch = 0;
while ((ch = bis.read()) != -1) {
System.out.println((char) ch);
}
System.out.println(bis.toString());
}
private static void output() throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
FileInputStream fis = new FileInputStream("异常日志.txt");
PrintStream ps = new PrintStream("后期设备的配置文件.properties");
int b = 0;
while ((b = fis.read()) != -1) {
bos.write(b);
}
fis.close();
ps.write(bos.toByteArray());
ps.close();
bos.close();
}
}