import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

public class ByteArrayStreamDemo {

    public static void main(String[] args) {
        
        
        //用io的读写思想操作数组
        //1.确定源
        ByteArrayInputStream bis = new ByteArrayInputStream("abcde".getBytes());//这个数据 可以来自于文件
        //2.确定目的
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        
        int by = 0;
        
        while((by=bis.read())!=-1){
            bos.write(by);
        }
        
        System.out.println(bos.toString());
        
    }

}

 

posted on 2016-10-01 16:41  北方丶有佳人  阅读(135)  评论(0编辑  收藏  举报