1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.johnzon.core; |
20 | |
|
21 | |
import java.io.InputStream; |
22 | |
import java.io.Reader; |
23 | |
import java.nio.charset.Charset; |
24 | |
|
25 | |
public class CommentsJsonStreamParserImpl extends JsonStreamParserImpl { |
26 | |
public CommentsJsonStreamParserImpl(final InputStream inputStream, |
27 | |
final int maxStringLength, |
28 | |
final BufferStrategy.BufferProvider<char[]> bufferProvider, |
29 | |
final BufferStrategy.BufferProvider<char[]> valueBuffer) { |
30 | 1 | super(inputStream, maxStringLength, bufferProvider, valueBuffer); |
31 | 1 | } |
32 | |
|
33 | |
public CommentsJsonStreamParserImpl(final InputStream inputStream, |
34 | |
final Charset encoding, |
35 | |
final int maxStringLength, |
36 | |
final BufferStrategy.BufferProvider<char[]> bufferProvider, |
37 | |
final BufferStrategy.BufferProvider<char[]> valueBuffer) { |
38 | 0 | super(inputStream, encoding, maxStringLength, bufferProvider, valueBuffer); |
39 | 0 | } |
40 | |
|
41 | |
public CommentsJsonStreamParserImpl(final Reader reader, |
42 | |
final int maxStringLength, |
43 | |
final BufferStrategy.BufferProvider<char[]> bufferProvider, |
44 | |
final BufferStrategy.BufferProvider<char[]> valueBuffer) { |
45 | 0 | super(reader, maxStringLength, bufferProvider, valueBuffer); |
46 | 0 | } |
47 | |
|
48 | |
@Override |
49 | |
protected Event defaultHandling(final char c) { |
50 | 7 | if (c == '/') { |
51 | 7 | char next = readNextChar(); |
52 | 7 | if (next == '/') { |
53 | |
do { |
54 | 84 | next = readNextChar(); |
55 | 84 | } while (next != EOL); |
56 | 4 | return next(); |
57 | 3 | } else if (next == '*') { |
58 | 3 | next = 0; |
59 | |
char previous; |
60 | |
do { |
61 | 97 | previous = next; |
62 | 97 | next = readNextNonWhitespaceChar(readNextChar()); |
63 | 97 | } while (next != '/' || previous != '*'); |
64 | 3 | readNextNonWhitespaceChar(next); |
65 | 3 | return next(); |
66 | |
} |
67 | |
} |
68 | 0 | return super.defaultHandling(c); |
69 | |
} |
70 | |
} |