1 18 package org.apache.batik.util.io; 19 20 import java.io.BufferedReader ; 21 import java.io.IOException ; 22 import java.io.InputStream ; 23 import java.io.InputStreamReader ; 24 import java.io.Reader ; 25 26 32 public class GenericDecoder implements CharDecoder { 33 34 37 protected Reader reader; 38 39 44 public GenericDecoder(InputStream is, String enc) throws IOException { 45 reader = new InputStreamReader (is, enc); 46 reader = new BufferedReader (reader); 47 } 48 49 53 public GenericDecoder(Reader r) { 54 reader = r; 55 if (!(r instanceof BufferedReader )) { 56 reader = new BufferedReader (reader); 57 } 58 } 59 60 64 public int readChar() throws IOException { 65 return reader.read(); 66 } 67 68 71 public void dispose() throws IOException { 72 reader.close(); 73 reader = null; 74 } 75 } 76 | Popular Tags |