public static SaslMessage decode(ByteBuf buf) { if (buf.readByte() != TAG_BYTE) { throw new IllegalStateException("Expected SaslMessage, received something else" + " (maybe your client does not have SASL enabled?)"); } String appId = Encoders.Strings.decode(buf); // See comment in encodedLength(). buf.readInt(); return new SaslMessage(appId, buf.retain()); } }
@Override public void encode(ByteBuf buf) { buf.writeByte(TAG_BYTE); Encoders.Strings.encode(buf, appId); // See comment in encodedLength(). buf.writeInt((int) body().size()); }
SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer());
SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer());
SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer());
public static SaslMessage decode(ByteBuf buf) { if (buf.readByte() != TAG_BYTE) { throw new IllegalStateException("Expected SaslMessage, received something else" + " (maybe your client does not have SASL enabled?)"); } String appId = Encoders.Strings.decode(buf); // See comment in encodedLength(). buf.readInt(); return new SaslMessage(appId, buf.retain()); } }
@Override public void encode(ByteBuf buf) { buf.writeByte(TAG_BYTE); Encoders.Strings.encode(buf, appId); // See comment in encodedLength(). buf.writeInt((int) body().size()); }
SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer());
public static SaslMessage decode(ByteBuf buf) { if (buf.readByte() != TAG_BYTE) { throw new IllegalStateException("Expected SaslMessage, received something else" + " (maybe your client does not have SASL enabled?)"); } String appId = Encoders.Strings.decode(buf); // See comment in encodedLength(). buf.readInt(); return new SaslMessage(appId, buf.retain()); } }
@Override public void encode(ByteBuf buf) { buf.writeByte(TAG_BYTE); Encoders.Strings.encode(buf, appId); // See comment in encodedLength(). buf.writeInt((int) body().size()); }
public static SaslMessage decode(ByteBuf buf) { if (buf.readByte() != TAG_BYTE) { throw new IllegalStateException("Expected SaslMessage, received something else" + " (maybe your client does not have SASL enabled?)"); } String appId = Encoders.Strings.decode(buf); // See comment in encodedLength(). buf.readInt(); return new SaslMessage(appId, buf.retain()); } }
@Override public void encode(ByteBuf buf) { buf.writeByte(TAG_BYTE); Encoders.Strings.encode(buf, appId); // See comment in encodedLength(). buf.writeInt((int) body().size()); }