2412 } |
2412 } |
2413 clear(); |
2413 clear(); |
2414 } |
2414 } |
2415 |
2415 |
2416 /** |
2416 /** |
2417 * Converts specified span of bytes into float values. |
|
2418 */ |
|
2419 // REMIND: remove once hotspot inlines Float.intBitsToFloat |
|
2420 private static native void bytesToFloats(byte[] src, int srcpos, |
|
2421 float[] dst, int dstpos, |
|
2422 int nfloats); |
|
2423 |
|
2424 /** |
|
2425 * Converts specified span of bytes into double values. |
|
2426 */ |
|
2427 // REMIND: remove once hotspot inlines Double.longBitsToDouble |
|
2428 private static native void bytesToDoubles(byte[] src, int srcpos, |
|
2429 double[] dst, int dstpos, |
|
2430 int ndoubles); |
|
2431 |
|
2432 /** |
|
2433 * Returns the first non-null and non-platform class loader (not counting |
2417 * Returns the first non-null and non-platform class loader (not counting |
2434 * class loaders of generated reflection implementation classes) up the |
2418 * class loaders of generated reflection implementation classes) up the |
2435 * execution stack, or the platform class loader if only code from the |
2419 * execution stack, or the platform class loader if only code from the |
2436 * bootstrap and platform class loader is on the stack. |
2420 * bootstrap and platform class loader is on the stack. |
2437 */ |
2421 */ |
3431 } |
3415 } |
3432 } |
3416 } |
3433 } |
3417 } |
3434 |
3418 |
3435 void readFloats(float[] v, int off, int len) throws IOException { |
3419 void readFloats(float[] v, int off, int len) throws IOException { |
3436 int span, endoff = off + len; |
3420 int stop, endoff = off + len; |
3437 while (off < endoff) { |
3421 while (off < endoff) { |
3438 if (!blkmode) { |
3422 if (!blkmode) { |
3439 span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 2); |
3423 int span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 2); |
3440 in.readFully(buf, 0, span << 2); |
3424 in.readFully(buf, 0, span << 2); |
|
3425 stop = off + span; |
3441 pos = 0; |
3426 pos = 0; |
3442 } else if (end - pos < 4) { |
3427 } else if (end - pos < 4) { |
3443 v[off++] = din.readFloat(); |
3428 v[off++] = din.readFloat(); |
3444 continue; |
3429 continue; |
3445 } else { |
3430 } else { |
3446 span = Math.min(endoff - off, ((end - pos) >> 2)); |
3431 stop = Math.min(endoff, ((end - pos) >> 2)); |
3447 } |
3432 } |
3448 |
3433 |
3449 bytesToFloats(buf, pos, v, off, span); |
3434 while (off < stop) { |
3450 off += span; |
3435 v[off++] = Bits.getFloat(buf, pos); |
3451 pos += span << 2; |
3436 pos += 4; |
|
3437 } |
3452 } |
3438 } |
3453 } |
3439 } |
3454 |
3440 |
3455 void readLongs(long[] v, int off, int len) throws IOException { |
3441 void readLongs(long[] v, int off, int len) throws IOException { |
3456 int stop, endoff = off + len; |
3442 int stop, endoff = off + len; |
3473 } |
3459 } |
3474 } |
3460 } |
3475 } |
3461 } |
3476 |
3462 |
3477 void readDoubles(double[] v, int off, int len) throws IOException { |
3463 void readDoubles(double[] v, int off, int len) throws IOException { |
3478 int span, endoff = off + len; |
3464 int stop, endoff = off + len; |
3479 while (off < endoff) { |
3465 while (off < endoff) { |
3480 if (!blkmode) { |
3466 if (!blkmode) { |
3481 span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 3); |
3467 int span = Math.min(endoff - off, MAX_BLOCK_SIZE >> 3); |
3482 in.readFully(buf, 0, span << 3); |
3468 in.readFully(buf, 0, span << 3); |
|
3469 stop = off + span; |
3483 pos = 0; |
3470 pos = 0; |
3484 } else if (end - pos < 8) { |
3471 } else if (end - pos < 8) { |
3485 v[off++] = din.readDouble(); |
3472 v[off++] = din.readDouble(); |
3486 continue; |
3473 continue; |
3487 } else { |
3474 } else { |
3488 span = Math.min(endoff - off, ((end - pos) >> 3)); |
3475 stop = Math.min(endoff - off, ((end - pos) >> 3)); |
3489 } |
3476 } |
3490 |
3477 |
3491 bytesToDoubles(buf, pos, v, off, span); |
3478 while (off < stop) { |
3492 off += span; |
3479 v[off++] = Bits.getDouble(buf, pos); |
3493 pos += span << 3; |
3480 pos += 8; |
|
3481 } |
3494 } |
3482 } |
3495 } |
3483 } |
3496 |
3484 |
3497 /** |
3485 /** |
3498 * Reads in string written in "long" UTF format. "Long" UTF format is |
3486 * Reads in string written in "long" UTF format. "Long" UTF format is |