1 package org.codehaus.groovy.syntax.lexer; 2 3 import java.io.Reader ; 4 import java.io.IOException ; 5 import org.codehaus.groovy.syntax.ReadException; 6 7 public class ReaderCharStream 8 extends AbstractCharStream 9 { 10 private Reader in; 11 12 public ReaderCharStream(Reader in) 13 { 14 this.in = in; 15 } 16 17 public ReaderCharStream(Reader in, 18 String description) 19 { 20 super( description ); 21 this.in = in; 22 } 23 24 public Reader getReader() 25 { 26 return in; 27 } 28 29 public char consume() 30 throws ReadException 31 { 32 try 33 { 34 return (char) getReader().read(); 35 } 36 catch( IOException e ) 37 { 38 throw new ReadException( e ); 39 } 40 } 41 42 public void close() 43 throws ReadException 44 { 45 try 46 { 47 getReader().close(); 48 } 49 catch( IOException e ) 50 { 51 throw new ReadException( e ); 52 } 53 } 54 } 55 | Popular Tags |