下面的例子读出文件aa.txt,并将读出的内容中的小写字母a全部替换为大写字母A。import java.io.*;
public class IOTest
{ public static void main(String args[])
  {try{ FileInputStream in=new FileInputStream("aa.txt") ;
        PushbackInputStream push=new PushbackInputStream(in);
        int c=0; 
        byte b[]=new byte[1];                 
        while ( (c=push.read())!=-1) 
          {   if(c=='a')        //回压的条件  
               { push.unread('A');   //push回压字节'A'。
                 push.read(b,0,1);     //push读出被回压的字节,放入数组b。
                 System.out.print(new String(b,0,1));
               }
             else
               {System.out.print((char)c);
               }
           }
        push.close();
       }
    catch(IOException e){}     
  }
}