@@ -75,7 +75,7 @@ enum UnknownNumberParsing {
7575
7676 private InputStream stream ;
7777 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
7979 private int bufferLenWithExtraSpace ;
8080
8181 private final byte [] originalBuffer ;
@@ -103,7 +103,7 @@ enum UnknownNumberParsing {
103103 this .tmp = tmp ;
104104 this .buffer = buffer ;
105105 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
107107 this .chars = tmp ;
108108 this .errorInfo = errorInfo ;
109109 this .doublePrecision = doublePrecision ;
@@ -121,34 +121,31 @@ enum UnknownNumberParsing {
121121 */
122122 @ Override
123123 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 ;
132132 }
133133
134134 /**
135135 * Bind input stream for processing.
136136 * Stream will be processed in byte[] chunks.
137137 * If stream is null, reference to stream will be released.
138- *
139- * @param stream set input stream
140- * @return itself
141138 */
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 );
150147 readLimit = Math .min (available , bufferLenWithExtraSpace );
151- this . length = available ;
148+ length = available ;
152149 }
153150 return this ;
154151 }
@@ -160,30 +157,29 @@ public JParser process(final InputStream stream) {
160157 *
161158 * @param newBuffer new buffer to use for processing
162159 * @param newLength length of buffer which can be used
163- * @return itself
164160 */
165161 public JParser process (final byte [] newBuffer , final int newLength ) {
166162 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
169165 }
170166 if (newLength > buffer .length ) {
171167 throw new IllegalArgumentException ("length can't be longer than buffer.length" );
172168 }
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 ;
178174 return this ;
179175 }
180176
181177 @ Override
182- public void names (JsonNames nextNames ) {
178+ public void names (final JsonNames names ) {
183179 if (currentNames != null ) {
184180 nameStack .push (currentNames );
185181 }
186- currentNames = nextNames ;
182+ currentNames = names ;
187183 }
188184
189185 /**
0 commit comments