package Test1;
import java.io.*;
public class ByteArrayInputStreamDemo01 {
/**
* @param args
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
String str="leigewudi";
InputStream input=new ByteArrayInputStream(str.getBytes());//向内存中输出内容
OutputStream out=new ByteArrayOutputStream();//从内存中读取内容
char c[]=new char[1024];
int temp,len=0;
while((temp=input.read())!=-1){//写入内存
c[len]=(char)temp;
len++;
}
out.write(new String(c).toUpperCase().getBytes());//从内存中读取
System.out.println(out.toString());//转大写
out.close();
input.close();
System.out.println(new String(c,0,len));
}
}
import java.io.*;
public class ByteArrayInputStreamDemo01 {
/**
* @param args
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
String str="leigewudi";
InputStream input=new ByteArrayInputStream(str.getBytes());//向内存中输出内容
OutputStream out=new ByteArrayOutputStream();//从内存中读取内容
char c[]=new char[1024];
int temp,len=0;
while((temp=input.read())!=-1){//写入内存
c[len]=(char)temp;
len++;
}
out.write(new String(c).toUpperCase().getBytes());//从内存中读取
System.out.println(out.toString());//转大写
out.close();
input.close();
System.out.println(new String(c,0,len));
}
}