测试下,再说![code=java]import java.io.*;
public class ByteArrayTest
{
public static void transform(InputStream ips,OutputStream ops)
{
int ch=0;
try
{
while((ch=ips.read())!=-1)
{
int upperCh=Character.toUpperCase((char)ch);
ops.write(upperCh);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
String str="kingxip";
byte[] src=str.getBytes();
ByteArrayInputStream baInput=new ByteArrayInputStream(src);
ByteArrayOutputStream baOut=new ByteArrayOutputStream();
transform(baInput,baOut);
byte[] result=baOut.toByteArray();
System.out.println(new String(result));
}
}[/code]
[ 本帖最后由 王卿 于 2011-07-30 10:44 编辑 ] |