c=in.read()字节方式读入,就是一次读入一个字节
(c=in.read()!=-1)中-1也可以写成EOF,即文件结束符
int C=(int)Character.toUpperCase((char)c);这句话中(char)c对c作强制类型转换,Character.toUpperCase()将小写字符转换成大写字符,接着(int)又是作强制类型转换.

解决方案 »

  1.   

    1,字符串---->字符数组
    2,字符数组---->读入内存
    3,字符转换---->新字符数组
    4,新字符数组---->输出
      

  2.   

    还有个问题:  out.write(C);  把数据存哪儿了?import java.io.*;
    public class ByteArrayTest
    {
    public static void main(String[] args) throws Exception
    {
    String tmp="abcdefghijklmnopqrstuvwxyz";
    byte[] src =tmp.getBytes();  // string(16位 UiCode) -> byte[](8位 ASCII)
    ByteArrayInputStream   input = new ByteArrayInputStream(src);
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    new ByteArrayTest().transform(input,output);
    byte[] result = output.toByteArray();  // 创建一个新分配的字节数组  是让result指向缓冲区数据对吗?
    System.out.println(new String(result));
    }
    public void transform(InputStream in,OutputStream out)
    {
    int c=0;
    try
    {
    while((c=in.read())!=-1)//read在读到流的结尾处返回-1
    {
    int C = (int)Character.toUpperCase((char)c);
    /* 
       读入的int c 是 ASCII码数值
       (char)c对c作强制类型转换     int -> char
       Character.toUpperCase()将小写字符转换成大写字符  char -> CHAR
       接着(int)又是作强制类型转换   char -> int
    */
    out.write(C);  // 把数据存到哪儿了, 是将数据存入缓冲区对吗?

    }
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    }
    }