Package naga.packetreader
Class CipherPacketReader
java.lang.Object
naga.packetreader.CipherPacketReader
- All Implemented Interfaces:
PacketReader
Example filter reader that decrypts the stream before passing it to its underlying reader.
- Author:
- Christoffer Lerno
-
Field Summary
Fields inherited from interface naga.PacketReader
SKIP_PACKET
-
Constructor Summary
ConstructorsConstructorDescriptionCipherPacketReader
(Cipher cipher, PacketReader reader) Creates a new CipherPacketReader. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
nextPacket
(ByteBuffer byteBuffer) Create a new packet using the ByteBuffer given.void
setReader
(PacketReader reader)
-
Constructor Details
-
CipherPacketReader
Creates a new CipherPacketReader.- Parameters:
cipher
- the cipher to use.reader
- the underlying packet reader we wish to employ.
-
-
Method Details
-
getReader
-
setReader
-
nextPacket
Description copied from interface:PacketReader
Create a new packet using the ByteBuffer given.If there isn't sufficient data to construct a packet, return null.
- Specified by:
nextPacket
in interfacePacketReader
- Parameters:
byteBuffer
- the byte buffer to use.- Returns:
- the new packet created, or null if no packet could be created. The method will continously be called until nextPacket returns null.
- Throws:
ProtocolViolationException
- is there was an error constructing the packet.
-