/** * Gets the length of the entire message. * * @return The length of the message. */ public final int getMessageLength() { return HEADER_LENGTH + getTotalbody(); }
protected BaseMessage(byte[] b) { magic = TapMagic.getMagicByByte(b[MAGIC_OFFSET]); opcode = TapOpcode.getOpcodeByByte(b[OPCODE_OFFSET]); keylength = decodeShort(b, KEYLENGTH_OFFSET); extralength = b[EXTRALENGTH_OFFSET]; datatype = b[DATATYPE_OFFSET]; vbucket = decodeShort(b, VBUCKET_OFFSET); totalbody = decodeInt(b, TOTALBODY_OFFSET); opaque = decodeInt(b, OPAQUE_OFFSET); cas = decodeLong(b, CAS_OFFSET); }
/** * Prints the message in byte form in a pretty way. This function is mainly * used for debugging.\ purposes. */ public static void printMessage(BaseMessage message, PrintWriter p) { int colNum = 0; byte[] mbytes = message.getBytes().array(); p.printf(" %5s%5s%5s%5s\n", "0", "1", "2", "3"); p.print(" ----------------------"); for (int i = 0; i < mbytes.length; i++) { if ((i % 4) == 0) { p.printf("\n%3d|", colNum); colNum += 4; } int field = mbytes[i]; if (field < 0) { field = field + 256; } p.printf("%5x", field); } p.print("\n\n"); p.flush(); } }
protected BaseMessage(byte[] b) { magic = TapMagic.getMagicByByte(b[MAGIC_OFFSET]); opcode = TapOpcode.getOpcodeByByte(b[OPCODE_OFFSET]); keylength = decodeShort(b, KEYLENGTH_OFFSET); extralength = b[EXTRALENGTH_OFFSET]; datatype = b[DATATYPE_OFFSET]; vbucket = decodeShort(b, VBUCKET_OFFSET); totalbody = decodeInt(b, TOTALBODY_OFFSET); opaque = decodeInt(b, OPAQUE_OFFSET); cas = decodeLong(b, CAS_OFFSET); }
protected BaseMessage(byte[] b) { magic = TapMagic.getMagicByByte(b[MAGIC_OFFSET]); opcode = TapOpcode.getOpcodeByByte(b[OPCODE_OFFSET]); keylength = decodeShort(b, KEYLENGTH_OFFSET); extralength = b[EXTRALENGTH_OFFSET]; datatype = b[DATATYPE_OFFSET]; vbucket = decodeShort(b, VBUCKET_OFFSET); totalbody = decodeInt(b, TOTALBODY_OFFSET); opaque = decodeInt(b, OPAQUE_OFFSET); cas = decodeLong(b, CAS_OFFSET); }
/** * Gets the length of the entire message. * * @return The length of the message. */ public final int getMessageLength() { return HEADER_LENGTH + getTotalbody(); }
/** * Gets the length of the entire message. * * @return The length of the message. */ public final int getMessageLength() { return HEADER_LENGTH + getTotalbody(); }