@@ -181,9 +181,9 @@ public Object getNext(Object array, int pt) throws Exception {
181
181
if (array == null ) {
182
182
switch (b ) {
183
183
case FLOAT32 :
184
- return Float .valueOf (doc .readFloat ());
184
+ return Double .valueOf (doc .readFloat ());
185
185
case FLOAT64 :
186
- return Float .valueOf (( float ) doc .readDouble ());
186
+ return Double .valueOf (doc .readDouble ());
187
187
case UINT8 :
188
188
return Integer .valueOf (doc .readUInt8 ());
189
189
case UINT16 :
@@ -203,17 +203,17 @@ public Object getNext(Object array, int pt) throws Exception {
203
203
case STR8 :
204
204
return doc .readString (doc .readUInt8 ());
205
205
case STR16 :
206
- return doc .readString (doc .readShort ());
206
+ return doc .readString (doc .readUnsignedShort ());
207
207
case STR32 :
208
208
return doc .readString (doc .readInt ());
209
209
}
210
210
} else {
211
211
switch (b ) {
212
212
case FLOAT32 :
213
- ((float []) array )[pt ] = doc .readFloat ();
213
+ ((double []) array )[pt ] = doc .readFloat ();
214
214
break ;
215
215
case FLOAT64 :
216
- ((float []) array )[pt ] = ( float ) doc .readDouble ();
216
+ ((double []) array )[pt ] = doc .readDouble ();
217
217
break ;
218
218
case UINT8 :
219
219
((int []) array )[pt ] = doc .readUInt8 ();
@@ -243,10 +243,10 @@ public Object getNext(Object array, int pt) throws Exception {
243
243
((String []) array )[pt ] = doc .readString (doc .readUInt8 ());
244
244
break ;
245
245
case STR16 :
246
- ((String []) array )[pt ] = doc .readString (doc .readShort ());
246
+ ((String []) array )[pt ] = doc .readString (doc .readUnsignedShort ());
247
247
break ;
248
248
case STR32 :
249
- ((String []) array )[pt ] = doc .readString (doc .readInt ());
249
+ ((String []) array )[pt ] = doc .readString (doc .readInt ()); // technically shoild be unsigned int
250
250
break ;
251
251
}
252
252
}
@@ -267,9 +267,9 @@ private Object getArray(int n) throws Exception {
267
267
int [] a = new int [n ];
268
268
a [0 ] = ((Integer ) v ).intValue ();
269
269
v = a ;
270
- } else if (v instanceof Float ) {
271
- float [] a = new float [n ];
272
- a [0 ] = ((Float ) v ).floatValue ();
270
+ } else if (v instanceof Number ) {
271
+ double [] a = new double [n ];
272
+ a [0 ] = ((Number ) v ).doubleValue ();
273
273
v = a ;
274
274
} else if (v instanceof String ) {
275
275
String [] a = new String [n ];
@@ -296,8 +296,6 @@ private Object getMap(int n) throws Exception {
296
296
Map <String , Object > map = new Hashtable <String , Object >();
297
297
for (int i = 0 ; i < n ; i ++) {
298
298
String key = getNext (null , 0 ).toString ();
299
- //Logger.info(key);
300
-
301
299
Object value = getNext (null , 0 );
302
300
if (value == null ) {
303
301
//Logger.info("null value for " + key);
@@ -366,10 +364,10 @@ public static Object decode(byte[] b) {
366
364
* @param divisor
367
365
* @return array of floats
368
366
*/
369
- public static float [] getFloats (byte [] b , int n , float divisor ) {
367
+ public static double [] getFloats (byte [] b , int n , float divisor ) {
370
368
if (b == null )
371
369
return null ;
372
- float [] a = new float [n ];
370
+ double [] a = new double [n ];
373
371
try {
374
372
switch ((b .length - 12 ) / n ) {
375
373
case 2 :
@@ -522,10 +520,10 @@ public static int[] rldecode32Delta(byte[] b, int n) {
522
520
* @param divisor
523
521
* @return array of floats
524
522
*/
525
- public static float [] rldecodef (byte [] b , int n , float divisor ) {
523
+ public static double [] rldecodef (byte [] b , int n , float divisor ) {
526
524
if (b == null )
527
525
return null ;
528
- float [] ret = new float [n ];
526
+ double [] ret = new double [n ];
529
527
for (int i = 0 , pt = 3 ; i < n ;) {
530
528
int val = BC .bytesToInt (b , (pt ++) << 2 , true );
531
529
for (int j = BC .bytesToInt (b , (pt ++) << 2 , true ); --j >= 0 ;)
@@ -545,10 +543,10 @@ public static float[] rldecodef(byte[] b, int n, float divisor) {
545
543
* @param divisor
546
544
* @return array of floats
547
545
*/
548
- public static float [] unpack16Deltaf (byte [] b , int n , float divisor ) {
546
+ public static double [] unpack16Deltaf (byte [] b , int n , float divisor ) {
549
547
if (b == null )
550
548
return null ;
551
- float [] ret = new float [n ];
549
+ double [] ret = new double [n ];
552
550
for (int i = 0 , pt = 6 , val = 0 , buf = 0 ; i < n ;) {
553
551
int diff = BC .bytesToShort (b , (pt ++) << 1 , true );
554
552
if (diff == Short .MAX_VALUE || diff == Short .MIN_VALUE ) {
@@ -575,10 +573,10 @@ public static float[] unpack16Deltaf(byte[] b, int n, float divisor) {
575
573
* @param divisor
576
574
* @return array of floats
577
575
*/
578
- public static float [] unpackf (byte [] b , int nBytes , int n , float divisor ) {
576
+ public static double [] unpackf (byte [] b , int nBytes , int n , float divisor ) {
579
577
if (b == null )
580
578
return null ;
581
- float [] ret = new float [n ];
579
+ double [] ret = new double [n ];
582
580
switch (nBytes ) {
583
581
case 1 :
584
582
for (int i = 0 , pt = 12 , offset = 0 ; i < n ;) {
0 commit comments