/** * Reads an int from 2 bytes of the given array at offset 0. * * @param b the byte array to read * @return the int value */ public static final int makeIntFromByte2(byte[] b) { return makeIntFromByte2(b, 0); }
/** * Reads an int from 2 bytes of the given array at offset 0. * * @param b the byte array to read * @return the int value */ public static int makeIntFromByte2(byte[] b) { return makeIntFromByte2(b, 0); }
/** * Reads an int from 2 bytes of the given array at offset 0. * * @param b the byte array to read * @return the int value */ public static final int makeIntFromByte2(byte[] b) { return makeIntFromByte2(b, 0); }
/** * Reads the byte array described by the security buffer stored at the * <code>securityBufferOffset</code> offset. * * @param msg the message where to read the security buffer and it's value * @param securityBufferOffset the offset at which to read the security buffer * @return a new byte array holding the data pointed by the security buffer */ public static final byte[] readSecurityBufferTarget(byte[] msg, int securityBufferOffset) { byte[] securityBuffer = new byte[8]; System.arraycopy(msg, securityBufferOffset, securityBuffer, 0, 8); ByteUtilities.changeWordEndianess(securityBuffer, 0, 8); int length = ByteUtilities.makeIntFromByte2(securityBuffer); int offset = ByteUtilities.makeIntFromByte4(securityBuffer, 4); byte[] secBufValue = new byte[length]; System.arraycopy(msg, offset, secBufValue, 0, length); return secBufValue; }
/** * Reads the byte array described by the security buffer stored at the * <code>securityBufferOffset</code> offset. * * @param msg the message where to read the security buffer and it's value * @param securityBufferOffset the offset at which to read the security buffer * @return a new byte array holding the data pointed by the security buffer */ public static final byte[] readSecurityBufferTarget(byte[] msg, int securityBufferOffset) { byte[] securityBuffer = new byte[8]; System.arraycopy(msg, securityBufferOffset, securityBuffer, 0, 8); ByteUtilities.changeWordEndianess(securityBuffer, 0, 8); int length = ByteUtilities.makeIntFromByte2(securityBuffer); int offset = ByteUtilities.makeIntFromByte4(securityBuffer, 4); byte[] secBufValue = new byte[length]; System.arraycopy(msg, offset, secBufValue, 0, length); return secBufValue; }
/** * Reads the byte array described by the security buffer stored at the * <code>securityBufferOffset</code> offset. * * @param msg the message where to read the security buffer and it's value * @param securityBufferOffset the offset at which to read the security buffer * @return a new byte array holding the data pointed by the security buffer */ public static byte[] readSecurityBufferTarget( byte[] msg, int securityBufferOffset) { byte[] securityBuffer = new byte[8]; System.arraycopy(msg, securityBufferOffset, securityBuffer, 0, 8); ByteUtilities.changeWordEndianess(securityBuffer, 0, 8); int length = ByteUtilities.makeIntFromByte2(securityBuffer); int offset = ByteUtilities.makeIntFromByte4(securityBuffer, 4); byte[] secBufValue = new byte[length]; System.arraycopy(msg, offset, secBufValue, 0, length); return secBufValue; }
ByteUtilities.changeByteEndianess(len, 0, 2); int length = ByteUtilities.makeIntFromByte2(len, 0); out.println("Length: " + length + " bytes"); out.print("Data: ");
ByteUtilities.changeByteEndianess(len, 0, 2); int length = ByteUtilities.makeIntFromByte2(len, 0); out.println("Length: " + length + " bytes"); out.print("Data: ");
ByteUtilities.changeByteEndianess(len, 0, 2); int length = ByteUtilities.makeIntFromByte2(len, 0); out.println("Length: " + length + " bytes"); out.print("Data: ");
byte[] size = new byte[2]; buf.get(size); int s = ByteUtilities.makeIntFromByte2(size); if (buf.remaining() >= s) { byte[] token = new byte[s];
byte[] size = new byte[2]; buf.get(size); int s = ByteUtilities.makeIntFromByte2(size); if (buf.remaining() >= s) { byte[] token = new byte[s];
byte[] size = new byte[2]; buf.get(size); int s = ByteUtilities.makeIntFromByte2(size); if (buf.remaining() >= s) { byte[] token = new byte[s];