
de.maximilianbrandau.intercom.codec.packets.AuthResponsePacket Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of intercom Show documentation
Show all versions of intercom Show documentation
intercom aims to simplify communication between your microservices.
package de.maximilianbrandau.intercom.codec.packets;
import de.maximilianbrandau.intercom.codec.IntercomByteBuf;
import de.maximilianbrandau.intercom.codec.IntercomPacket;
import de.maximilianbrandau.intercom.codec.PacketType;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class AuthResponsePacket extends IntercomPacket {
private final ByteBuf buffer;
public AuthResponsePacket(ByteBuf buffer) {
this.buffer = buffer;
}
public AuthResponsePacket() {
this.buffer = Unpooled.buffer();
}
public ByteBuf getBuffer() {
return buffer;
}
@Override
public PacketType getPacketType() {
return PacketType.AUTH;
}
@Override
public void encode(IntercomByteBuf byteBuffer) {
byteBuffer.writeInt(buffer.writerIndex());
byteBuffer.writeBytes(buffer);
}
@Override
public void decode(IntercomByteBuf byteBuffer) {
buffer.readBytes(byteBuffer, byteBuffer.readInt());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy