1 | /* Generated by: ParserGeneratorCC: Do not edit this line. SimpleCharStream.java Version 1.1 */ |
---|---|
2 | /* ParserGeneratorCCOptions:SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ |
3 | /* |
4 | * Copyright (C) 2007-2010 JĂșlio Vilmar Gesser. |
5 | * Copyright (C) 2011, 2013-2020 The JavaParser Team. |
6 | * |
7 | * This file is part of JavaParser. |
8 | * |
9 | * JavaParser can be used either under the terms of |
10 | * a) the GNU Lesser General Public License as published by |
11 | * the Free Software Foundation, either version 3 of the License, or |
12 | * (at your option) any later version. |
13 | * b) the terms of the Apache License |
14 | * |
15 | * You should have received a copy of both licenses in LICENCE.LGPL and |
16 | * LICENCE.APACHE. Please refer to those files for details. |
17 | * |
18 | * JavaParser is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU Lesser General Public License for more details. |
22 | */ |
23 | package com.github.javaparser; |
24 | |
25 | /** |
26 | * An implementation of interface CharStream, where the stream is assumed to |
27 | * contain only ASCII characters (without unicode processing). |
28 | */ |
29 | public |
30 | class SimpleCharStream extends AbstractCharStream |
31 | { |
32 | private Provider inputStream; |
33 | |
34 | @Override |
35 | protected int streamRead (final char[] aBuf, final int nOfs, final int nLen) throws java.io.IOException |
36 | { |
37 | return inputStream.read (aBuf, nOfs, nLen); |
38 | } |
39 | |
40 | @Override |
41 | protected void streamClose() throws java.io.IOException |
42 | { |
43 | inputStream.close (); |
44 | } |
45 | |
46 | /** Constructor. */ |
47 | public SimpleCharStream(final Provider dstream, |
48 | final int startline, |
49 | final int startcolumn, |
50 | final int buffersize) |
51 | { |
52 | super (startline, startcolumn, buffersize); |
53 | inputStream = dstream; |
54 | } |
55 | |
56 | /** Constructor. */ |
57 | public SimpleCharStream(final Provider dstream, |
58 | final int startline, |
59 | final int startcolumn) |
60 | { |
61 | this(dstream, startline, startcolumn, DEFAULT_BUF_SIZE); |
62 | } |
63 | |
64 | /** Constructor. */ |
65 | public SimpleCharStream(final Provider dstream) |
66 | { |
67 | this(dstream, 1, 1, DEFAULT_BUF_SIZE); |
68 | } |
69 | |
70 | /** Reinitialise. */ |
71 | public void reInit(final Provider dstream, |
72 | final int startline, |
73 | final int startcolumn, |
74 | final int buffersize) |
75 | { |
76 | inputStream = dstream; |
77 | super.reInit (startline, startcolumn, buffersize); |
78 | } |
79 | |
80 | /** Reinitialise. */ |
81 | public void reInit(final Provider dstream, |
82 | final int startline, |
83 | final int startcolumn) |
84 | { |
85 | reInit(dstream, startline, startcolumn, DEFAULT_BUF_SIZE); |
86 | } |
87 | |
88 | /** Reinitialise. */ |
89 | public void reInit(final Provider dstream) |
90 | { |
91 | reInit(dstream, 1, 1, DEFAULT_BUF_SIZE); |
92 | } |
93 | } |
94 | /* ParserGeneratorCC - OriginalChecksum=9b6ba29c6edc2d17a5f2a6053a85cc82 (do not edit this line) */ |
95 |
Members