/** * Sets integer at specified position. * * @param pos Specified position. * @param i Integer to set. */ public void set(int pos, int i) { assert pos >= 0; assert pos + 4 <= size; U.intToBytes(i, data, pos); }
/** {@inheritDoc} */ @Override public void requestId(long reqId) { U.intToBytes((int)reqId, opaque, 0); }
/** * Appends integer to the next 4 bytes of list. * * @param i Integer to append. */ public void add(int i) { requestFreeSize(4); U.intToBytes(i, data, size); size += 4; }
/** * @param b Buffer to copy from. * @param off Offset in source buffer. * @param len Length. * @param resBuf Result buffer. * @param resOff Result offset. */ private void messageToBuffer(byte[] b, int off, int len, byte[] resBuf, int resOff) { assert b.length == len; assert off == 0; assert resBuf.length >= resOff + len + 4; U.intToBytes(len, resBuf, resOff); U.arrayCopy(b, off, resBuf, resOff + 4, len); }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] fillHeader(byte[] hdr, long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; Arrays.fill(hdr, (byte)0); U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] fillHeader(byte[] hdr, long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; Arrays.fill(hdr, (byte)0); U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] createHeader(long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; byte[] hdr = new byte[HEADER_SIZE]; U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
/** * Creates new header with given request ID and command. * * @param reqId Request ID. * @param cmd Command. * @return Created header. */ public static byte[] createHeader(long reqId, GridGgfsIpcCommand cmd) { assert cmd != null; byte[] hdr = new byte[HEADER_SIZE]; U.longToBytes(reqId, hdr, 0); U.intToBytes(cmd.ordinal(), hdr, 8); return hdr; }
byte[] hdr = new byte[RES_HEADER_SIZE]; U.intToBytes(resType, hdr, 0); U.intToBytes(len, hdr, off);
byte[] hdr = new byte[RES_HEADER_SIZE]; U.intToBytes(resType, hdr, 0); U.intToBytes(len, hdr, off);
data = U.intToBytes((Integer)obj); data = U.intToBytes(Float.floatToIntBits((Float)obj));
data = U.intToBytes((Integer) obj); data = U.intToBytes(Float.floatToIntBits((Float)obj));
/** * Converts cache version to byte array. * * @param ver Version. * @return Byte array. */ public static byte[] versionToBytes(GridCacheVersion ver) { assert ver != null; byte[] bytes = new byte[28]; U.intToBytes(ver.topologyVersion(), bytes, 0); U.longToBytes(ver.globalTime(), bytes, 4); U.longToBytes(ver.order(), bytes, 12); U.intToBytes(ver.nodeOrderAndDrIdRaw(), bytes, 20); return bytes; }
out.write(U.intToBytes(part), 0, 4); // Avoid IOException.
/** * Write request size. * * @param out Output. * @param size Size. */ private static void writeSize(GridUnsafeDataOutput out, int size) { U.intToBytes(size, out.internalArray(), out.offset()); out.offset(out.offset() + 4); }
off = U.intToBytes(metrics.getMaximumActiveJobs(), data, off); off = U.intToBytes(metrics.getCurrentActiveJobs(), data, off); off = U.floatToBytes(metrics.getAverageActiveJobs(), data, off); off = U.intToBytes(metrics.getMaximumWaitingJobs(), data, off); off = U.intToBytes(metrics.getCurrentWaitingJobs(), data, off); off = U.floatToBytes(metrics.getAverageWaitingJobs(), data, off); off = U.intToBytes(metrics.getMaximumRejectedJobs(), data, off); off = U.intToBytes(metrics.getCurrentRejectedJobs(), data, off); off = U.floatToBytes(metrics.getAverageRejectedJobs(), data, off); off = U.intToBytes(metrics.getMaximumCancelledJobs(), data, off); off = U.intToBytes(metrics.getCurrentCancelledJobs(), data, off); off = U.floatToBytes(metrics.getAverageCancelledJobs(), data, off); off = U.intToBytes(metrics.getTotalRejectedJobs(), data , off); off = U.intToBytes(metrics.getTotalCancelledJobs(), data , off); off = U.intToBytes(metrics.getTotalExecutedJobs(), data , off); off = U.longToBytes(metrics.getMaximumJobWaitTime(), data, off); off = U.longToBytes(metrics.getCurrentJobWaitTime(), data, off); off = U.longToBytes(metrics.getCurrentJobExecuteTime(), data, off); off = U.doubleToBytes(metrics.getAverageJobExecuteTime(), data, off); off = U.intToBytes(metrics.getTotalExecutedTasks(), data, off); off = U.longToBytes(metrics.getCurrentIdleTime(), data, off); off = U.longToBytes(metrics.getTotalIdleTime(), data , off); off = U.intToBytes(metrics.getTotalCpus(), data, off); off = U.doubleToBytes(metrics.getCurrentCpuLoad(), data, off); off = U.doubleToBytes(metrics.getAverageCpuLoad(), data, off); off = U.longToBytes(metrics.getNodeStartTime(), data, off); off = U.longToBytes(metrics.getUpTime(), data, off);
U.intToBytes(req.length(), hdr, 20);
U.intToBytes(req.length(), hdr, 20);