/** * @param arr Array. * @param off Offset. * @return Value. */ public static long readLong(byte[] arr, int off) { long pos = GridUnsafe.BYTE_ARR_OFF + off; return BIG_ENDIAN ? GridUnsafe.getLongLE(arr, pos) : GridUnsafe.getLong(arr, pos); }
/** {@inheritDoc} */ @Override protected long readLongFast() { long off = GridUnsafe.BYTE_ARR_OFF + pos; return BIG_ENDIAN ? GridUnsafe.getLongLE(data, off) : GridUnsafe.getLong(data, off); }
/** * @param ptr Pointer. * @param off Offset. * @return Value. */ public static long readLong(long ptr, int off) { long addr = ptr + off; return BIG_ENDIAN ? GridUnsafe.getLongLE(addr) : GridUnsafe.getLong(addr); }
/** {@inheritDoc} */ @Override protected long readLongFast() { long addr = ptr + pos; return BIG_ENDIAN ? GridUnsafe.getLongLE(addr) : GridUnsafe.getLong(addr); }
/** {@inheritDoc} */ @Override public long readLong() throws IOException { fromStream(8); long off = BYTE_ARR_OFF + offset(8); return BIG_ENDIAN ? GridUnsafe.getLongLE(buf, off) : GridUnsafe.getLong(buf, off); }
/** {@inheritDoc} */ @Override public long[] readLongArray() throws IOException { int arrSize = readInt(); int bytesToCp = arrSize << 3; fromStream(bytesToCp); long[] arr = new long[arrSize]; long off = BYTE_ARR_OFF + offset(bytesToCp); if (BIG_ENDIAN) { for (int i = 0; i < arr.length; i++) { arr[i] = GridUnsafe.getLongLE(buf, off); off += 8; } } else GridUnsafe.copyMemory(buf, off, arr, LONG_ARR_OFF, bytesToCp); return arr; }
/** {@inheritDoc} */ @Override protected long readLongFast() { long off = GridUnsafe.BYTE_ARR_OFF + pos; return BIG_ENDIAN ? GridUnsafe.getLongLE(data, off) : GridUnsafe.getLong(data, off); }
/** {@inheritDoc} */ @Override protected long readLongFast() { long addr = ptr + pos; return BIG_ENDIAN ? GridUnsafe.getLongLE(addr) : GridUnsafe.getLong(addr); }
/** * @param arr Array. * @param off Offset. * @return Value. */ public static long readLong(byte[] arr, int off) { long pos = GridUnsafe.BYTE_ARR_OFF + off; return BIG_ENDIAN ? GridUnsafe.getLongLE(arr, pos) : GridUnsafe.getLong(arr, pos); }
/** * @param ptr Pointer. * @param off Offset. * @return Value. */ public static long readLong(long ptr, int off) { long addr = ptr + off; return BIG_ENDIAN ? GridUnsafe.getLongLE(addr) : GridUnsafe.getLong(addr); }
/** {@inheritDoc} */ @Override public long readLong() throws IOException { fromStream(8); long off = BYTE_ARR_OFF + offset(8); return BIG_ENDIAN ? GridUnsafe.getLongLE(buf, off) : GridUnsafe.getLong(buf, off); }
/** {@inheritDoc} */ @Override public long[] readLongArray() throws IOException { int arrSize = readInt(); int bytesToCp = arrSize << 3; fromStream(bytesToCp); long[] arr = new long[arrSize]; long off = BYTE_ARR_OFF + offset(bytesToCp); if (BIG_ENDIAN) { for (int i = 0; i < arr.length; i++) { arr[i] = GridUnsafe.getLongLE(buf, off); off += 8; } } else GridUnsafe.copyMemory(buf, off, arr, LONG_ARR_OFF, bytesToCp); return arr; }