88 |
|
|
89 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
90 |
{ |
{ |
91 |
buffer.put ((byte) (((int) value) & 0x00ff)); |
buffer.put ((byte) (value & 0x00ff)); |
92 |
buffer.put ((byte) ((((int) value) & 0xff00) >> 8)); |
buffer.put ((byte) ((value & 0xff00) >> 8)); |
93 |
} |
} |
94 |
else |
else |
95 |
{ |
{ |
96 |
buffer.put ((byte) ((((int) value) & 0xff00) >> 8)); |
buffer.put ((byte) ((value & 0xff00) >> 8)); |
97 |
buffer.put ((byte) (((int) value) & 0x00ff)); |
buffer.put ((byte) (value & 0x00ff)); |
98 |
} |
} |
99 |
|
|
100 |
return buffer; |
return buffer; |
106 |
|
|
107 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
108 |
{ |
{ |
109 |
return (char) (((buffer.get (index + 1) & 0xff) << 8) |
return (char) ((buffer.get (index) & 0xff) |
110 |
+ (buffer.get (index) & 0xff)); |
+ ((buffer.get (index + 1) & 0xff) << 8)); |
111 |
} |
} |
112 |
|
|
113 |
return (char) (((buffer.get (index) & 0xff) << 8) |
return (char) (((buffer.get (index) & 0xff) << 8) |
121 |
|
|
122 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
123 |
{ |
{ |
124 |
buffer.put (index + 1, (byte) ((((int) value) & 0x00ff) >> 8)); |
buffer.put (index, (byte) (value & 0xff00)); |
125 |
buffer.put (index, (byte) (((int) value) & 0xff00)); |
buffer.put (index + 1, (byte) ((value & 0x00ff) >> 8)); |
126 |
} |
} |
127 |
else |
else |
128 |
{ |
{ |
129 |
buffer.put (index, (byte) ((((int) value) & 0xff00) >> 8)); |
buffer.put (index, (byte) ((value & 0xff00) >> 8)); |
130 |
buffer.put (index + 1, (byte) (((int) value) & 0x00ff)); |
buffer.put (index + 1, (byte) (value & 0x00ff)); |
131 |
} |
} |
132 |
|
|
133 |
return buffer; |
return buffer; |
153 |
|
|
154 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
155 |
{ |
{ |
156 |
buffer.put ((byte) (((int) value) & 0x00ff)); |
buffer.put ((byte) (value & 0x00ff)); |
157 |
buffer.put ((byte) ((((int) value) & 0xff00) >> 8)); |
buffer.put ((byte) ((value & 0xff00) >> 8)); |
158 |
} |
} |
159 |
else |
else |
160 |
{ |
{ |
161 |
buffer.put ((byte) ((((int) value) & 0xff00) >> 8)); |
buffer.put ((byte) ((value & 0xff00) >> 8)); |
162 |
buffer.put ((byte) (((int) value) & 0x00ff)); |
buffer.put ((byte) (value & 0x00ff)); |
163 |
} |
} |
164 |
|
|
165 |
return buffer; |
return buffer; |
186 |
|
|
187 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
188 |
{ |
{ |
189 |
buffer.put (index + 1, (byte) ((((int) value) & 0xff00) >> 8)); |
buffer.put (index, (byte) (value & 0x00ff)); |
190 |
buffer.put (index, (byte) (((int) value) & 0x00ff)); |
buffer.put (index + 1, (byte) ((value & 0xff00) >> 8)); |
191 |
} |
} |
192 |
else |
else |
193 |
{ |
{ |
194 |
buffer.put (index, (byte) ((((int) value) & 0xff00) >> 8)); |
buffer.put (index, (byte) ((value & 0xff00) >> 8)); |
195 |
buffer.put (index + 1, (byte) (((int) value) & 0x00ff)); |
buffer.put (index + 1, (byte) (value & 0x00ff)); |
196 |
} |
} |
197 |
|
|
198 |
return buffer; |
return buffer; |
263 |
|
|
264 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
265 |
{ |
{ |
|
buffer.put (index + 3, (byte) ((value & 0xff000000) >> 24)); |
|
|
buffer.put (index + 2, (byte) ((value & 0x00ff0000) >> 16)); |
|
|
buffer.put (index + 1, (byte) ((value & 0x0000ff00) >> 8)); |
|
266 |
buffer.put (index, (byte) (value & 0x000000ff)); |
buffer.put (index, (byte) (value & 0x000000ff)); |
267 |
|
buffer.put (index + 1, (byte) ((value & 0x0000ff00) >> 8)); |
268 |
|
buffer.put (index + 2, (byte) ((value & 0x00ff0000) >> 16)); |
269 |
|
buffer.put (index + 3, (byte) ((value & 0xff000000) >> 24)); |
270 |
} |
} |
271 |
else |
else |
272 |
{ |
{ |
289 |
+ ((buffer.get() & 0xff) << 8) |
+ ((buffer.get() & 0xff) << 8) |
290 |
+ ((buffer.get() & 0xff) << 16) |
+ ((buffer.get() & 0xff) << 16) |
291 |
+ ((buffer.get() & 0xff) << 24) |
+ ((buffer.get() & 0xff) << 24) |
292 |
+ ((buffer.get() & 0xff) << 32) |
+ ((buffer.get() & 0xffL) << 32) |
293 |
+ ((buffer.get() & 0xff) << 40) |
+ ((buffer.get() & 0xffL) << 40) |
294 |
+ ((buffer.get() & 0xff) << 48) |
+ ((buffer.get() & 0xffL) << 48) |
295 |
+ ((buffer.get() & 0xff) << 56)); |
+ ((buffer.get() & 0xffL) << 56)); |
296 |
} |
} |
297 |
|
|
298 |
return (long) (((buffer.get() & 0xff) << 56) |
return (long) (((buffer.get() & 0xffL) << 56) |
299 |
+ ((buffer.get() & 0xff) << 48) |
+ ((buffer.get() & 0xffL) << 48) |
300 |
+ ((buffer.get() & 0xff) << 40) |
+ ((buffer.get() & 0xffL) << 40) |
301 |
+ ((buffer.get() & 0xff) << 32) |
+ ((buffer.get() & 0xffL) << 32) |
302 |
+ ((buffer.get() & 0xff) << 24) |
+ ((buffer.get() & 0xff) << 24) |
303 |
+ ((buffer.get() & 0xff) << 16) |
+ ((buffer.get() & 0xff) << 16) |
304 |
+ ((buffer.get() & 0xff) << 8) |
+ ((buffer.get() & 0xff) << 8) |
311 |
|
|
312 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
313 |
{ |
{ |
314 |
buffer.put ((byte) (value & 0xff00000000000000L)); |
buffer.put ((byte) (((int) value) & 0xff)); |
315 |
buffer.put ((byte) ((value & 0x00ff000000000000L) >> 8)); |
buffer.put ((byte) (((int) (value >> 8)) & 0xff)); |
316 |
buffer.put ((byte) ((value & 0x0000ff0000000000L) >> 16)); |
buffer.put ((byte) (((int) (value >> 16)) & 0xff)); |
317 |
buffer.put ((byte) ((value & 0x000000ff00000000L) >> 24)); |
buffer.put ((byte) (((int) (value >> 24)) & 0xff)); |
318 |
buffer.put ((byte) ((value & 0x00000000ff000000L) >> 32)); |
buffer.put ((byte) (((int) (value >> 32)) & 0xff)); |
319 |
buffer.put ((byte) ((value & 0x0000000000ff0000L) >> 40)); |
buffer.put ((byte) (((int) (value >> 40)) & 0xff)); |
320 |
buffer.put ((byte) ((value & 0x000000000000ff00L) >> 48)); |
buffer.put ((byte) (((int) (value >> 48)) & 0xff)); |
321 |
buffer.put ((byte) ((value & 0x00000000000000ffL) >> 56)); |
buffer.put ((byte) (((int) (value >> 56)) & 0xff)); |
322 |
} |
} |
323 |
else |
else |
324 |
{ |
{ |
325 |
buffer.put ((byte) ((value & 0xff00000000000000L) >> 56)); |
buffer.put ((byte) (((int) (value >> 56)) & 0xff)); |
326 |
buffer.put ((byte) ((value & 0x00ff000000000000L) >> 48)); |
buffer.put ((byte) (((int) (value >> 48)) & 0xff)); |
327 |
buffer.put ((byte) ((value & 0x0000ff0000000000L) >> 40)); |
buffer.put ((byte) (((int) (value >> 40)) & 0xff)); |
328 |
buffer.put ((byte) ((value & 0x000000ff00000000L) >> 32)); |
buffer.put ((byte) (((int) (value >> 32)) & 0xff)); |
329 |
buffer.put ((byte) ((value & 0x00000000ff000000L) >> 24)); |
buffer.put ((byte) (((int) (value >> 24)) & 0xff)); |
330 |
buffer.put ((byte) ((value & 0x0000000000ff0000L) >> 16)); |
buffer.put ((byte) (((int) (value >> 16)) & 0xff)); |
331 |
buffer.put ((byte) ((value & 0x000000000000ff00L) >> 8)); |
buffer.put ((byte) (((int) (value >> 8)) & 0xff)); |
332 |
buffer.put ((byte) (value & 0x00000000000000ffL)); |
buffer.put ((byte) (((int) value) & 0xff)); |
333 |
} |
} |
334 |
|
|
335 |
return buffer; |
return buffer; |
345 |
+ ((buffer.get (index + 1) & 0xff) << 8) |
+ ((buffer.get (index + 1) & 0xff) << 8) |
346 |
+ ((buffer.get (index + 2) & 0xff) << 16) |
+ ((buffer.get (index + 2) & 0xff) << 16) |
347 |
+ ((buffer.get (index + 3) & 0xff) << 24) |
+ ((buffer.get (index + 3) & 0xff) << 24) |
348 |
+ ((buffer.get (index + 4) & 0xff) << 32) |
+ ((buffer.get (index + 4) & 0xffL) << 32) |
349 |
+ ((buffer.get (index + 5) & 0xff) << 40) |
+ ((buffer.get (index + 5) & 0xffL) << 40) |
350 |
+ ((buffer.get (index + 6) & 0xff) << 48) |
+ ((buffer.get (index + 6) & 0xffL) << 48) |
351 |
+ ((buffer.get (index + 7) & 0xff) << 56)); |
+ ((buffer.get (index + 7) & 0xffL) << 56)); |
352 |
} |
} |
353 |
|
|
354 |
return (long) (((buffer.get (index) & 0xff) << 56) |
return (long) (((buffer.get (index) & 0xffL) << 56) |
355 |
+ ((buffer.get (index + 1) & 0xff) << 48) |
+ ((buffer.get (index + 1) & 0xffL) << 48) |
356 |
+ ((buffer.get (index + 2) & 0xff) << 40) |
+ ((buffer.get (index + 2) & 0xffL) << 40) |
357 |
+ ((buffer.get (index + 3) & 0xff) << 32) |
+ ((buffer.get (index + 3) & 0xffL) << 32) |
358 |
+ ((buffer.get (index + 4) & 0xff) << 24) |
+ ((buffer.get (index + 4) & 0xff) << 24) |
359 |
+ ((buffer.get (index + 5) & 0xff) << 16) |
+ ((buffer.get (index + 5) & 0xff) << 16) |
360 |
+ ((buffer.get (index + 6) & 0xff) << 8) |
+ ((buffer.get (index + 6) & 0xff) << 8) |
368 |
|
|
369 |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
370 |
{ |
{ |
371 |
buffer.put (index + 7, (byte) ((value & 0xff00000000000000L) >> 56)); |
buffer.put (index, (byte) (((int) value) & 0xff)); |
372 |
buffer.put (index + 6, (byte) ((value & 0x00ff000000000000L) >> 48)); |
buffer.put (index + 1, (byte) (((int) (value >> 8)) & 0xff)); |
373 |
buffer.put (index + 5, (byte) ((value & 0x0000ff0000000000L) >> 40)); |
buffer.put (index + 2, (byte) (((int) (value >> 16)) & 0xff)); |
374 |
buffer.put (index + 4, (byte) ((value & 0x000000ff00000000L) >> 32)); |
buffer.put (index + 3, (byte) (((int) (value >> 24)) & 0xff)); |
375 |
buffer.put (index + 3, (byte) ((value & 0x00000000ff000000L) >> 24)); |
buffer.put (index + 4, (byte) (((int) (value >> 32)) & 0xff)); |
376 |
buffer.put (index + 2, (byte) ((value & 0x0000000000ff0000L) >> 16)); |
buffer.put (index + 5, (byte) (((int) (value >> 40)) & 0xff)); |
377 |
buffer.put (index + 1, (byte) ((value & 0x000000000000ff00L) >> 8)); |
buffer.put (index + 6, (byte) (((int) (value >> 48)) & 0xff)); |
378 |
buffer.put (index, (byte) (value & 0x00000000000000ffL)); |
buffer.put (index + 7, (byte) (((int) (value >> 56)) & 0xff)); |
379 |
} |
} |
380 |
else |
else |
381 |
{ |
{ |
382 |
buffer.put (index, (byte) ((value & 0xff00000000000000L) >> 56)); |
buffer.put (index, (byte) (((int) (value >> 56)) & 0xff)); |
383 |
buffer.put (index + 1, (byte) ((value & 0x00ff000000000000L) >> 48)); |
buffer.put (index + 1, (byte) (((int) (value >> 48)) & 0xff)); |
384 |
buffer.put (index + 2, (byte) ((value & 0x0000ff0000000000L) >> 40)); |
buffer.put (index + 2, (byte) (((int) (value >> 40)) & 0xff)); |
385 |
buffer.put (index + 3, (byte) ((value & 0x000000ff00000000L) >> 32)); |
buffer.put (index + 3, (byte) (((int) (value >> 32)) & 0xff)); |
386 |
buffer.put (index + 4, (byte) ((value & 0x00000000ff000000L) >> 24)); |
buffer.put (index + 4, (byte) (((int) (value >> 24)) & 0xff)); |
387 |
buffer.put (index + 5, (byte) ((value & 0x0000000000ff0000L) >> 16)); |
buffer.put (index + 5, (byte) (((int) (value >> 16)) & 0xff)); |
388 |
buffer.put (index + 6, (byte) ((value & 0x000000000000ff00L) >> 8)); |
buffer.put (index + 6, (byte) (((int) (value >> 8)) & 0xff)); |
389 |
buffer.put (index + 7, (byte) (value & 0x00000000000000ffL)); |
buffer.put (index + 7, (byte) (((int) value) & 0xff)); |
390 |
} |
} |
391 |
|
|
392 |
return buffer; |
return buffer; |
394 |
|
|
395 |
public static final float getFloat (ByteBuffer buffer) |
public static final float getFloat (ByteBuffer buffer) |
396 |
{ |
{ |
397 |
checkRemainingForRead (buffer, 4); |
return Float.intBitsToFloat (getInt (buffer)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
return (float) ((buffer.get() & 0xff) |
|
|
+ ((buffer.get() & 0xff) << 8) |
|
|
+ ((buffer.get() & 0xff) << 16) |
|
|
+ ((buffer.get() & 0xff) << 24)); |
|
|
} |
|
|
|
|
|
return (float) (((buffer.get() & 0xff) << 24) |
|
|
+ ((buffer.get() & 0xff) << 16) |
|
|
+ ((buffer.get() & 0xff) << 8) |
|
|
+ (buffer.get() & 0xff)); |
|
398 |
} |
} |
399 |
|
|
400 |
public static final ByteBuffer putFloat (ByteBuffer buffer, float value) |
public static final ByteBuffer putFloat (ByteBuffer buffer, float value) |
401 |
{ |
{ |
402 |
checkRemainingForWrite (buffer, 4); |
return putInt (buffer, Float.floatToIntBits (value)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
buffer.put ((byte) (((int) value) & 0xff000000)); |
|
|
buffer.put ((byte) ((((int) value) & 0x00ff0000) >> 8)); |
|
|
buffer.put ((byte) ((((int) value) & 0x0000ff00) >> 16)); |
|
|
buffer.put ((byte) ((((int) value) & 0x000000ff) >> 24)); |
|
|
} |
|
|
else |
|
|
{ |
|
|
buffer.put ((byte) ((((int) value) & 0xff000000) >> 24)); |
|
|
buffer.put ((byte) ((((int) value) & 0x00ff0000) >> 16)); |
|
|
buffer.put ((byte) ((((int) value) & 0x0000ff00) >> 8)); |
|
|
buffer.put ((byte) (((int) value) & 0x000000ff)); |
|
|
} |
|
|
|
|
|
return buffer; |
|
403 |
} |
} |
404 |
|
|
405 |
public static final float getFloat (ByteBuffer buffer, int index) |
public static final float getFloat (ByteBuffer buffer, int index) |
406 |
{ |
{ |
407 |
checkAvailableForRead (buffer, index, 4); |
return Float.intBitsToFloat (getInt (buffer, index)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
return (float) ((buffer.get (index) & 0xff) |
|
|
+ ((buffer.get (index + 1) & 0xff) << 8) |
|
|
+ ((buffer.get (index + 2) & 0xff) << 16) |
|
|
+ ((buffer.get (index + 3) & 0xff) << 24)); |
|
|
} |
|
|
|
|
|
return (float) (((buffer.get (index) & 0xff) << 24) |
|
|
+ ((buffer.get (index + 1) & 0xff) << 16) |
|
|
+ ((buffer.get (index + 2) & 0xff) << 8) |
|
|
+ (buffer.get (index + 3) & 0xff)); |
|
408 |
} |
} |
409 |
|
|
410 |
public static final ByteBuffer putFloat (ByteBuffer buffer, int index, |
public static final ByteBuffer putFloat (ByteBuffer buffer, int index, |
411 |
float value) |
float value) |
412 |
{ |
{ |
413 |
checkAvailableForWrite (buffer, index, 4); |
return putInt (buffer, index, Float.floatToIntBits (value)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
buffer.put (index + 3, (byte) ((((int) value) & 0xff000000) >> 24)); |
|
|
buffer.put (index + 2, (byte) ((((int) value) & 0x00ff0000) >> 16)); |
|
|
buffer.put (index + 1, (byte) ((((int) value) & 0x0000ff00) >> 8)); |
|
|
buffer.put (index, (byte) (((int) value) & 0x000000ff)); |
|
|
} |
|
|
else |
|
|
{ |
|
|
buffer.put (index, (byte) ((((int) value) & 0xff000000) >> 24)); |
|
|
buffer.put (index + 1, (byte) ((((int) value) & 0x00ff0000) >> 16)); |
|
|
buffer.put (index + 2, (byte) ((((int) value) & 0x0000ff00) >> 8)); |
|
|
buffer.put (index + 3, (byte) (((int) value) & 0x000000ff)); |
|
|
} |
|
|
|
|
|
return buffer; |
|
414 |
} |
} |
415 |
|
|
416 |
public static final double getDouble (ByteBuffer buffer) |
public static final double getDouble (ByteBuffer buffer) |
417 |
{ |
{ |
418 |
checkRemainingForRead (buffer, 8); |
return Double.longBitsToDouble (getLong (buffer)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
return (double) ((buffer.get() & 0xff) |
|
|
+ ((buffer.get() & 0xff) << 8) |
|
|
+ ((buffer.get() & 0xff) << 16) |
|
|
+ ((buffer.get() & 0xff) << 24) |
|
|
+ ((buffer.get() & 0xff) << 32) |
|
|
+ ((buffer.get() & 0xff) << 40) |
|
|
+ ((buffer.get() & 0xff) << 48) |
|
|
+ ((buffer.get() & 0xff) << 56)); |
|
|
} |
|
|
|
|
|
return (double) (((buffer.get() & 0xff) << 56) |
|
|
+ ((buffer.get() & 0xff) << 48) |
|
|
+ ((buffer.get() & 0xff) << 40) |
|
|
+ ((buffer.get() & 0xff) << 32) |
|
|
+ ((buffer.get() & 0xff) << 24) |
|
|
+ ((buffer.get() & 0xff) << 16) |
|
|
+ ((buffer.get() & 0xff) << 8) |
|
|
+ (buffer.get() & 0xff)); |
|
419 |
} |
} |
420 |
|
|
421 |
public static final ByteBuffer putDouble (ByteBuffer buffer, double value) |
public static final ByteBuffer putDouble (ByteBuffer buffer, double value) |
422 |
{ |
{ |
423 |
checkRemainingForWrite (buffer, 8); |
return putLong (buffer, Double.doubleToLongBits (value)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
buffer.put ((byte) (((long) value) & 0xff00000000000000L)); |
|
|
buffer.put ((byte) ((((long) value) & 0x00ff000000000000L) >> 8)); |
|
|
buffer.put ((byte) ((((long) value) & 0x0000ff0000000000L) >> 16)); |
|
|
buffer.put ((byte) ((((long) value) & 0x000000ff00000000L) >> 24)); |
|
|
buffer.put ((byte) ((((long) value) & 0x00000000ff000000L) >> 32)); |
|
|
buffer.put ((byte) ((((long) value) & 0x0000000000ff0000L) >> 40)); |
|
|
buffer.put ((byte) ((((long) value) & 0x000000000000ff00L) >> 48)); |
|
|
buffer.put ((byte) ((((long) value) & 0x00000000000000ffL) >> 56)); |
|
|
} |
|
|
else |
|
|
{ |
|
|
buffer.put ((byte) ((((long) value) & 0xff00000000000000L) >> 56)); |
|
|
buffer.put ((byte) ((((long) value) & 0x00ff000000000000L) >> 48)); |
|
|
buffer.put ((byte) ((((long) value) & 0x0000ff0000000000L) >> 40)); |
|
|
buffer.put ((byte) ((((long) value) & 0x000000ff00000000L) >> 32)); |
|
|
buffer.put ((byte) ((((long) value) & 0x00000000ff000000L) >> 24)); |
|
|
buffer.put ((byte) ((((long) value) & 0x0000000000ff0000L) >> 16)); |
|
|
buffer.put ((byte) ((((long) value) & 0x000000000000ff00L) >> 8)); |
|
|
buffer.put ((byte) (((long) value) & 0x00000000000000ffL)); |
|
|
} |
|
|
|
|
|
return buffer; |
|
424 |
} |
} |
425 |
|
|
426 |
public static final double getDouble (ByteBuffer buffer, int index) |
public static final double getDouble (ByteBuffer buffer, int index) |
427 |
{ |
{ |
428 |
checkAvailableForRead (buffer, index, 8); |
return Double.longBitsToDouble (getLong (buffer, index)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
return (double) ((buffer.get (index) & 0xff) |
|
|
+ ((buffer.get (index + 1) & 0xff) << 8) |
|
|
+ ((buffer.get (index + 2) & 0xff) << 16) |
|
|
+ ((buffer.get (index + 3) & 0xff) << 24) |
|
|
+ ((buffer.get (index + 4) & 0xff) << 32) |
|
|
+ ((buffer.get (index + 5) & 0xff) << 40) |
|
|
+ ((buffer.get (index + 6) & 0xff) << 48) |
|
|
+ ((buffer.get (index + 7) & 0xff) << 56)); |
|
|
} |
|
|
|
|
|
return (double) (((buffer.get (index) & 0xff) << 56) |
|
|
+ ((buffer.get (index + 1) & 0xff) << 48) |
|
|
+ ((buffer.get (index + 2) & 0xff) << 40) |
|
|
+ ((buffer.get (index + 3) & 0xff) << 32) |
|
|
+ ((buffer.get (index + 4) & 0xff) << 24) |
|
|
+ ((buffer.get (index + 5) & 0xff) << 16) |
|
|
+ ((buffer.get (index + 6) & 0xff) << 8) |
|
|
+ (buffer.get (index + 7) & 0xff)); |
|
429 |
} |
} |
430 |
|
|
431 |
public static final ByteBuffer putDouble (ByteBuffer buffer, int index, |
public static final ByteBuffer putDouble (ByteBuffer buffer, int index, |
432 |
double value) |
double value) |
433 |
{ |
{ |
434 |
checkAvailableForWrite (buffer, index, 8); |
return putLong (buffer, index, Double.doubleToLongBits (value)); |
|
|
|
|
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) |
|
|
{ |
|
|
buffer.put (index + 7, (byte) ((((long) value) & 0xff00000000000000L) >> 56)); |
|
|
buffer.put (index + 6, (byte) ((((long) value) & 0x00ff000000000000L) >> 48)); |
|
|
buffer.put (index + 5, (byte) ((((long) value) & 0x0000ff0000000000L) >> 40)); |
|
|
buffer.put (index + 4, (byte) ((((long) value) & 0x000000ff00000000L) >> 32)); |
|
|
buffer.put (index + 3, (byte) ((((long) value) & 0x00000000ff000000L) >> 24)); |
|
|
buffer.put (index + 2, (byte) ((((long) value) & 0x0000000000ff0000L) >> 16)); |
|
|
buffer.put (index + 1, (byte) ((((long) value) & 0x000000000000ff00L) >> 8)); |
|
|
buffer.put (index, (byte) (((long) value) & 0x00000000000000ffL)); |
|
|
} |
|
|
else |
|
|
{ |
|
|
buffer.put (index, (byte) ((((long) value) & 0xff00000000000000L) >> 56)); |
|
|
buffer.put (index + 1, (byte) ((((long) value) & 0x00ff000000000000L) >> 48)); |
|
|
buffer.put (index + 2, (byte) ((((long) value) & 0x0000ff0000000000L) >> 40)); |
|
|
buffer.put (index + 3, (byte) ((((long) value) & 0x000000ff00000000L) >> 32)); |
|
|
buffer.put (index + 4, (byte) ((((long) value) & 0x00000000ff000000L) >> 24)); |
|
|
buffer.put (index + 5, (byte) ((((long) value) & 0x0000000000ff0000L) >> 16)); |
|
|
buffer.put (index + 6, (byte) ((((long) value) & 0x000000000000ff00L) >> 8)); |
|
|
buffer.put (index + 7, (byte) (((long) value) & 0x00000000000000ffL)); |
|
|
} |
|
|
|
|
|
return buffer; |
|
435 |
} |
} |
436 |
|
|
437 |
} // ByteBufferHelper |
} // ByteBufferHelper |