public class CALMNETPacketFactory extends java.lang.Object implements IPacketFactory
IPacketFactory
for calmnet packets.Constructor and Description |
---|
CALMNETPacketFactory(boolean preferStreamPackets,
PacketLoader loader)
Constructs a new Instance of CALMNETPacketFactory with if
IStreamedPacket s are preferred and the specified PacketLoader . |
CALMNETPacketFactory(boolean preferStreamPackets,
PacketLoader loader,
IPacketFactory factory)
Constructs a new Instance of CALMNETPacketFactory with if
IStreamedPacket s are preferred, the specified PacketLoader and the IPacketFactory . |
Modifier and Type | Method and Description |
---|---|
boolean |
areStreamPacketsPreferred()
Gets if
getPacket(PacketProtocolInformation) prefers returning IStreamedPacket s if possible. |
com.captainalm.lib.stdcrypt.encryption.ICipherFactory |
getCipherFactory()
Gets the
ICipherFactory in use (Could be the same instance). |
IPacket |
getPacket(PacketProtocolInformation information)
Constructs a
IPacket of the protocol specified by the passed PacketProtocolInformation instance. |
IPacketFactory |
getPacketFactory()
Gets the
IPacketFactory in use (Could be the same instance). |
PacketLoader |
getPacketLoader()
Gets the
PacketLoader in use. |
void |
setCipherFactory(com.captainalm.lib.stdcrypt.encryption.ICipherFactory factory)
Sets the
ICipherFactory in use. |
void |
setPacketFactory(IPacketFactory factory)
Sets the
IPacketFactory in use (null signifies to use the same instance). |
void |
setPacketLoader(PacketLoader loader)
Sets the
PacketLoader to use. |
void |
setStreamPacketsPreferred(boolean preferred)
Sets if
getPacket(PacketProtocolInformation) prefers returning IStreamedPacket s if possible. |
public CALMNETPacketFactory(boolean preferStreamPackets, PacketLoader loader)
IStreamedPacket
s are preferred and the specified PacketLoader
.preferStreamPackets
- If streamed packets are preferred for construction.loader
- The packet loader to use.java.lang.NullPointerException
- loader is null.public CALMNETPacketFactory(boolean preferStreamPackets, PacketLoader loader, IPacketFactory factory)
IStreamedPacket
s are preferred, the specified PacketLoader
and the IPacketFactory
.preferStreamPackets
- If streamed packets are preferred for construction.loader
- The packet loader to use.factory
- The packet factory to use or null (null signifies to use the same instance).java.lang.NullPointerException
- loader is null.public IPacket getPacket(PacketProtocolInformation information)
IPacket
of the protocol specified by the passed PacketProtocolInformation
instance.getPacket
in interface IPacketFactory
information
- The protocol information to use.java.lang.NullPointerException
- The information is null.public boolean areStreamPacketsPreferred()
getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.areStreamPacketsPreferred
in interface IPacketFactory
public void setStreamPacketsPreferred(boolean preferred)
getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.setStreamPacketsPreferred
in interface IPacketFactory
preferred
- If streamed packets are preferred for construction.public IPacketFactory getPacketFactory()
IPacketFactory
in use (Could be the same instance).public void setPacketFactory(IPacketFactory factory)
IPacketFactory
in use (null signifies to use the same instance).factory
- The packet factory to use or null.public PacketLoader getPacketLoader()
PacketLoader
in use.public void setPacketLoader(PacketLoader loader)
PacketLoader
to use.loader
- The packet loader to use.java.lang.NullPointerException
- loader is null.public com.captainalm.lib.stdcrypt.encryption.ICipherFactory getCipherFactory()
ICipherFactory
in use (Could be the same instance).public void setCipherFactory(com.captainalm.lib.stdcrypt.encryption.ICipherFactory factory)
ICipherFactory
in use.factory
- The cipher factory to use or null.