KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > groovy > syntax > lexer > ReaderCharStream


1 package org.codehaus.groovy.syntax.lexer;
2
3 import java.io.Reader JavaDoc;
4 import java.io.IOException JavaDoc;
5 import org.codehaus.groovy.syntax.ReadException;
6
7 public class ReaderCharStream
8     extends AbstractCharStream
9 {
10     private Reader JavaDoc in;
11
12     public ReaderCharStream(Reader JavaDoc in)
13     {
14         this.in = in;
15     }
16
17     public ReaderCharStream(Reader JavaDoc in,
18                             String JavaDoc description)
19     {
20         super( description );
21         this.in = in;
22     }
23
24     public Reader JavaDoc 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 JavaDoc 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 JavaDoc e )
50         {
51             throw new ReadException( e );
52         }
53     }
54 }
55
Popular Tags