ByteArrayInputStream(字节数组输入流) 示例

import java.io.*;
class ByteArrayInputStreamDemo{
	String strTmp = "BonShi";
	byte b[] strTmp.getBytes();
	ByteArrayInputStream in = new ByteArrayInputStram(b);
	
	for(int i=0;i<2;i++){
		int c;
		while((c=in.read())!=-1){
			if(i==0){
				System.out.print((char)c);
			}else{
				System.out.println(Character.toUpperCase((char)c));
			}
			System.out.println();
			in.reset();
		}
	
	}
}
posted @ 2010-02-02 10:40  Bon.Shi  阅读(488)  评论(0编辑  收藏  举报