ByteArrayInputStream与ByteArrayOutputStream_操作数组的流

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

public class Test {
    public static void main(String[] args) throws IOException {
        ByteArrayInputStream bis = new ByteArrayInputStream("abcedf".getBytes());
        
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        
        int ch = 0;
        
        while((ch=bis.read())!=-1){
            bos.write(ch);
        }
        
        System.out.println(bos.toString());
    }
}

 

posted @ 2014-03-14 00:02  胡椒粉hjf  阅读(151)  评论(0编辑  收藏  举报