Class CipherPacketWriter

  • All Implemented Interfaces:
    PacketWriter

    public class CipherPacketWriter
    extends java.lang.Object
    implements PacketWriter
    Example Writer that encrypts the outgoing stream using a Cipher object.
    Author:
    Christoffer Lerno
    • Constructor Detail

      • CipherPacketWriter

        public CipherPacketWriter​(javax.crypto.Cipher cipher,
                                  PacketWriter packetWriter)
    • Method Detail

      • setPacketWriter

        public void setPacketWriter​(PacketWriter packetWriter)
      • write

        public java.nio.ByteBuffer[] write​(java.nio.ByteBuffer[] byteBuffer)
        Description copied from interface: PacketWriter
        Convert the incoming bytes to the bytes to be serialized.
        Specified by:
        write in interface PacketWriter
        Parameters:
        byteBuffer - an array of ByteBuffers containing data the bytes to be written.
        Returns:
        the resulting array of ByteBuffers.