/** * Encode <code>integer</code> as a series of 4 bytes into <code>buf</code> * starting at position 0 within that buffer. * * @param integer * The integer to encode. * @param buf * The buffer to write to. */ public static final void encodeBigEndian(final int integer, final byte[] buf) { encodeBigEndian(integer, buf, 0); }
/** * Encode <code>integer</code> as a series of 4 bytes into <code>buf</code> * starting at position 0 within that buffer. * * @param integer * The integer to encode. * @param buf * The buffer to write to. */ public static final void encodeBigEndian(final int integer, final byte[] buf) { encodeBigEndian(integer, buf, 0); }
/** * Send a complete Thrift SASL message. * * @param status * The status to send. * @param payload * The data to send as the payload of this message. * @throws TTransportException */ protected void sendSaslMessage(NegotiationStatus status, byte[] payload) throws TTransportException { if (payload == null) payload = new byte[0]; messageHeader[0] = status.getValue(); EncodingUtils.encodeBigEndian(payload.length, messageHeader, STATUS_BYTES); if (LOGGER.isDebugEnabled()) LOGGER.debug(getRole() + ": Writing message with status {} and payload length {}", status, payload.length); underlyingTransport.write(messageHeader); underlyingTransport.write(payload); underlyingTransport.flush(); }
/** * Send a complete Thrift SASL message. * * @param status * The status to send. * @param payload * The data to send as the payload of this message. * @throws TTransportException */ protected void sendSaslMessage(NegotiationStatus status, byte[] payload) throws TTransportException { if (payload == null) payload = new byte[0]; messageHeader[0] = status.getValue(); EncodingUtils.encodeBigEndian(payload.length, messageHeader, STATUS_BYTES); if (LOGGER.isDebugEnabled()) LOGGER.debug(getRole() + ": Writing message with status {} and payload length {}", status, payload.length); underlyingTransport.write(messageHeader); underlyingTransport.write(payload); underlyingTransport.flush(); }