@@ -190,7 +190,8 @@ public final boolean readArray() throws IOException {
190190 }
191191
192192 public String readNumberAsString () throws IOException {
193- return IterImplForStreaming .readNumber (this );
193+ IterImplForStreaming .numberChars numberChars = IterImplForStreaming .readNumber (this );
194+ return new String (numberChars .chars , 0 , numberChars .charsLength );
194195 }
195196
196197 public static interface ReadArrayCallback {
@@ -239,7 +240,8 @@ public final BigDecimal readBigDecimal() throws IOException {
239240 if (valueType != ValueType .NUMBER ) {
240241 throw reportError ("readBigDecimal" , "not number" );
241242 }
242- return new BigDecimal (IterImplForStreaming .readNumber (this ));
243+ IterImplForStreaming .numberChars numberChars = IterImplForStreaming .readNumber (this );
244+ return new BigDecimal (numberChars .chars , 0 , numberChars .charsLength );
243245 }
244246
245247 public final BigInteger readBigInteger () throws IOException {
@@ -252,7 +254,8 @@ public final BigInteger readBigInteger() throws IOException {
252254 if (valueType != ValueType .NUMBER ) {
253255 throw reportError ("readBigDecimal" , "not number" );
254256 }
255- return new BigInteger (IterImplForStreaming .readNumber (this ));
257+ IterImplForStreaming .numberChars numberChars = IterImplForStreaming .readNumber (this );
258+ return new BigInteger (new String (numberChars .chars , 0 , numberChars .charsLength ));
256259 }
257260
258261 public final Any readAny () throws IOException {
@@ -288,9 +291,14 @@ public final Object read() throws IOException {
288291 case STRING :
289292 return readString ();
290293 case NUMBER :
291- double number = readDouble ();
292- if (number == Math .floor (number ) && !Double .isInfinite (number )) {
293- long longNumber = (long ) number ;
294+ IterImplForStreaming .numberChars numberChars = IterImplForStreaming .readNumber (this );
295+ Double number = Double .valueOf (new String (numberChars .chars , 0 , numberChars .charsLength ));
296+ if (numberChars .dotFound ) {
297+ return number ;
298+ }
299+ double doubleNumber = number ;
300+ if (doubleNumber == Math .floor (doubleNumber ) && !Double .isInfinite (doubleNumber )) {
301+ long longNumber = (long ) doubleNumber ;
294302 if (longNumber <= Integer .MAX_VALUE && longNumber >= Integer .MIN_VALUE ) {
295303 return (int ) longNumber ;
296304 }
0 commit comments