黑马程序员24-6: 字节数组流ByteArrayInputStream

------- android培训 java培训、期待与您交流!-------




package cn.itcast.io.p6.bytestream;

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

public class ByteArrayStreamDemo {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) {

		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());
	}

}



------- android培训 java培训、期待与您交流!-------


详细请查看: http://edu.csdn.net/heima -------

你可能感兴趣的:(黑马程序员24-6: 字节数组流ByteArrayInputStream)