[antlr-interest] v3 stream input
Martin Probst
mail at martin-probst.com
Fri May 26 22:23:24 PDT 2006
Hi,
> public class ANTLRInputStream extends ANTLRStringStream {
>
> public ANTLRInputStream(InputStream stream) throws IOException
> {
> load(stream);
> }
>
> public void load(InputStream istream) throws IOException
> {
> BufferedReader br = new BufferedReader(new
> InputStreamReader(istream));
^^^^^^^^^^^^^^^^^^^^^^^^^^
This is the place that is going to bite you some day - you need to
allow specifying a charset somehow, always taking the system default
is maybe a bit too optimistic.
> CharArrayWriter wr = new CharArrayWriter();
> BufferedWriter bw = new BufferedWriter(wr);
I think you don't need to have a buffered writer around an im memory
char array, but then again, I'm not that great in the complex
scientific topic that is reading a simple file in Java ;-)
More information about the antlr-interest
mailing list