001package headfirst.decorator.io; 002 003import java.io.BufferedInputStream; 004import java.io.FileInputStream; 005import java.io.IOException; 006import java.io.InputStream; 007 008public class InputTest { 009 public static void main(String[] args) { 010 int c; 011 012 try { 013 InputStream in = 014 new LowerCaseInputStream( 015 new BufferedInputStream( 016 new FileInputStream("test.txt"))); 017 018 while((c = in.read()) >= 0) { 019 System.out.print((char)c); 020 } 021 022 in.close(); 023 } catch (IOException e) { 024 e.printStackTrace(); 025 } 026 } 027}