@@ -75,7 +75,7 @@ enum UnknownNumberParsing {
75
75
76
76
private InputStream stream ;
77
77
private int readLimit ;
78
- //always leave some room for reading special stuff, so that buffer contains enough padding for such optimizations
78
+ // always leave some room for reading special stuff, so that buffer contains enough padding for such optimizations
79
79
private int bufferLenWithExtraSpace ;
80
80
81
81
private final byte [] originalBuffer ;
@@ -103,7 +103,7 @@ enum UnknownNumberParsing {
103
103
this .tmp = tmp ;
104
104
this .buffer = buffer ;
105
105
this .length = length ;
106
- this .bufferLenWithExtraSpace = buffer .length - 38 ; //currently maximum padding is for uuid
106
+ this .bufferLenWithExtraSpace = buffer .length - 38 ; // maximum padding is for uuid
107
107
this .chars = tmp ;
108
108
this .errorInfo = errorInfo ;
109
109
this .doublePrecision = doublePrecision ;
@@ -121,34 +121,31 @@ enum UnknownNumberParsing {
121
121
*/
122
122
@ Override
123
123
public void close () {
124
- this . buffer = this . originalBuffer ;
125
- this . bufferLenWithExtraSpace = this . originalBufferLenWithExtraSpace ;
126
- this . last = ' ' ;
127
- this . currentIndex = 0 ;
128
- this . length = 0 ;
129
- this . readLimit = 0 ;
130
- this . nameStack .clear ();
131
- this . stream = null ;
124
+ buffer = originalBuffer ;
125
+ bufferLenWithExtraSpace = originalBufferLenWithExtraSpace ;
126
+ last = ' ' ;
127
+ currentIndex = 0 ;
128
+ length = 0 ;
129
+ readLimit = 0 ;
130
+ nameStack .clear ();
131
+ stream = null ;
132
132
}
133
133
134
134
/**
135
135
* Bind input stream for processing.
136
136
* Stream will be processed in byte[] chunks.
137
137
* If stream is null, reference to stream will be released.
138
- *
139
- * @param stream set input stream
140
- * @return itself
141
138
*/
142
- public JParser process (final InputStream stream ) {
143
- this . nameStack .clear ();
144
- this . currentPosition = 0 ;
145
- this . currentIndex = 0 ;
146
- this . stream = stream ;
147
- if (stream != null ) {
148
- this . readLimit = Math .min (this . length , bufferLenWithExtraSpace );
149
- final int available = readFully (buffer , stream , 0 );
139
+ public JParser process (final InputStream newStream ) {
140
+ nameStack .clear ();
141
+ currentPosition = 0 ;
142
+ currentIndex = 0 ;
143
+ stream = newStream ;
144
+ if (newStream != null ) {
145
+ readLimit = Math .min (length , bufferLenWithExtraSpace );
146
+ final int available = readFully (buffer , newStream , 0 );
150
147
readLimit = Math .min (available , bufferLenWithExtraSpace );
151
- this . length = available ;
148
+ length = available ;
152
149
}
153
150
return this ;
154
151
}
@@ -160,30 +157,29 @@ public JParser process(final InputStream stream) {
160
157
*
161
158
* @param newBuffer new buffer to use for processing
162
159
* @param newLength length of buffer which can be used
163
- * @return itself
164
160
*/
165
161
public JParser process (final byte [] newBuffer , final int newLength ) {
166
162
if (newBuffer != null ) {
167
- this . buffer = newBuffer ;
168
- this . bufferLenWithExtraSpace = buffer .length - 38 ; // maximum padding is for uuid
163
+ buffer = newBuffer ;
164
+ bufferLenWithExtraSpace = buffer .length - 38 ; // maximum padding is for uuid
169
165
}
170
166
if (newLength > buffer .length ) {
171
167
throw new IllegalArgumentException ("length can't be longer than buffer.length" );
172
168
}
173
- this . nameStack .clear ();
174
- this . currentIndex = 0 ;
175
- this . length = newLength ;
176
- this . stream = null ;
177
- this . readLimit = newLength ;
169
+ nameStack .clear ();
170
+ currentIndex = 0 ;
171
+ length = newLength ;
172
+ stream = null ;
173
+ readLimit = newLength ;
178
174
return this ;
179
175
}
180
176
181
177
@ Override
182
- public void names (JsonNames nextNames ) {
178
+ public void names (final JsonNames names ) {
183
179
if (currentNames != null ) {
184
180
nameStack .push (currentNames );
185
181
}
186
- currentNames = nextNames ;
182
+ currentNames = names ;
187
183
}
188
184
189
185
/**
0 commit comments