package io.p6.bytestream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class byteArrayStreamDemo {
public static void main(String[] args) throws IOException {
ByteArrayInputStream bis=new ByteArrayInputStream("abcdefg".getBytes());//如果源或者目的是内存 操作内存的
ByteArrayOutputStream bos=new ByteArrayOutputStream();
int ch=0;
while((ch=bis.read())!=-1) {
bos.write(ch);
}
System.out.println(bos.toString());
}
}
Java 操作数组的流
最新推荐文章于 2022-02-10 22:27:03 发布