private boolean eightByteSizeReady() { // The payload size is encoded as 64-bit unsigned integer. // The most significant byte comes first. final long msgSize = ByteBuffer.wrap(tmpbuf).getLong(); // Message size must not exceed the maximum allowed size. if (maxmsgsize >= 0) { if (msgSize > maxmsgsize) { decodingError(); return false; } } // Message size must fit within range of size_t data type. if (msgSize > Integer.MAX_VALUE) { decodingError(); return false; } // inProgress is initialised at this point so in theory we should // close it before calling init_size, however, it's a 0-byte // message and thus we can treat it as uninitialised. inProgress = new Msg((int) msgSize); inProgress.setFlags(msgFlags); nextStep(inProgress.data(), inProgress.size(), MESSAGE_READY); return true; }
private boolean oneByteSizeReady() { int size = tmpbuf[0]; if (size < 0) { size = (0xff) & size; } // Message size must not exceed the maximum allowed size. if (maxmsgsize >= 0) { if (size > maxmsgsize) { decodingError(); return false; } } // inProgress is initialised at this point so in theory we should // close it before calling zmq_msg_init_size, however, it's a 0-byte // message and thus we can treat it as uninitialised... inProgress = new Msg(size); inProgress.setFlags(msgFlags); nextStep(inProgress.data(), inProgress.size(), MESSAGE_READY); return true; }