package joeho.net.csdn.blog.io;
import java.io.*;
public class ByteArrayTest {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
String strData = "afaerttwertrwert";
byte[] buf = strData.getBytes();
ByteArrayInputStream in = new ByteArrayInputStream(buf);
ByteArrayOutputStream out = new ByteArrayOutputStream();
upperTransform(in,out);
System.out.println(new String(out.toByteArray()));
//从键盘接受数据,用CTRL+Z退出
upperTransform(System.in,System.out);
}
/**
* Method upperTransform
*
*
* @param in
* @param out
*
*/
public static void upperTransform(InputStream in, OutputStream out) {
// TODO: Add your code here
int ch=0;
try{
while((ch=in.read())!=-1){
ch = Character.toUpperCase(ch);
out.write(ch);
}
}catch(Exception e){e.printStackTrace();}
}
}