public final class CandidateClient
+extends java.lang.Object
+NetMarshalServer
s.Modifier and Type | +Field and Description | +
---|---|
boolean |
+accept
+Whether the candidate should be accepted.
+ |
+
java.net.InetAddress |
+address
+The remote address of the candidate.
+ |
+
int |
+port
+The remote port of the candidate.
+ |
+
Constructor and Description | +
---|
CandidateClient(java.net.InetAddress address,
+ int port)
+Constructs a new instance of CandidateClient with an address and port.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+equals(java.lang.Object o) |
+
int |
+hashCode() |
+
boolean |
+matchesNetMarshalClient(NetMarshalClient toCheck)
+Checks if this candidate matches an existing
+NetMarshalClient . |
+
getClass, notify, notifyAll, toString, wait, wait, wait
public final java.net.InetAddress address+
public final int port+
public boolean accept+
public CandidateClient(java.net.InetAddress address, + int port)+
address
- The remote address of the candidate.port
- The remote port of the candidate.java.lang.NullPointerException
- address is null.public boolean matchesNetMarshalClient(NetMarshalClient toCheck)+
NetMarshalClient
.toCheck
- The client to check against.public boolean equals(java.lang.Object o)+
equals
in class java.lang.Object
public int hashCode()+
hashCode
in class java.lang.Object
public final class FragmentationOptions
+extends java.lang.Object
+FragmentSender
s and
+ FragmentReceiver
s in this package.Modifier and Type | +Field and Description | +
---|---|
int |
+emptySendsTillForced
+
+ |
+
boolean |
+equalityVerifyFragments
+
+ |
+
int |
+fragmentationSplitSize
+
+ |
+
int |
+maximumFragmentAge
+The maximum age of fragments for a specified packet in seconds before those fragments are purged.
+ |
+
boolean |
+verifyFragments
+
+ |
+
Constructor and Description | +
---|
FragmentationOptions() |
+
FragmentationOptions(FragmentationOptions toCopy)
+Creates a copy of the provided FragmentationOptions.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+setupReceiver(FragmentReceiver receiver)
+Sets-up the provided
+FragmentReceiver with parameters. |
+
void |
+setupSender(FragmentSender sender)
+Sets-up the provided
+FragmentSender with parameters. |
+
void |
+validate()
+Validates the parameters within this structure.
+ |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public int maximumFragmentAge+
public int fragmentationSplitSize+ +
public int emptySendsTillForced+ +
public boolean verifyFragments+ +
public boolean equalityVerifyFragments+ +
public FragmentationOptions()+
public FragmentationOptions(FragmentationOptions toCopy)+
toCopy
- The options to copy.java.lang.NullPointerException
- toCopy is null.public void validate()+
java.lang.IllegalArgumentException
- maximumFragmentAge is less than 2, fragmentationSplitSize is less than 1 or emptySendsTillForced is less than 1.public void setupSender(FragmentSender sender)+
FragmentSender
with parameters.sender
- The sender to set up.java.lang.IllegalArgumentException
- A parameter is incorrect.public void setupReceiver(FragmentReceiver receiver)+
FragmentReceiver
with parameters.receiver
- The receiver to set up.java.lang.IllegalArgumentException
- A parameter is incorrect.public class NetMarshalClient
+extends java.lang.Object
+implements java.io.Closeable
+Constructor and Description | +
---|
NetMarshalClient(java.net.DatagramSocket socketIn,
+ java.net.InetAddress remoteAddress,
+ int remotePort,
+ java.io.InputStream inputStream,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions)
+Constructs a new NetMarshalClient with the specified
+DatagramSocket , remote InetAddress , remote port, InputStream , IPacketFactory , PacketLoader and FragmentationOptions . |
+
NetMarshalClient(java.net.DatagramSocket socketIn,
+ java.net.InetAddress remoteAddress,
+ int remotePort,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions)
+Constructs a new NetMarshalClient with the specified
+DatagramSocket , remote InetAddress , remote port, IPacketFactory , PacketLoader and FragmentationOptions . |
+
NetMarshalClient(java.net.MulticastSocket socketIn,
+ java.net.InetAddress multicastGroupAddress,
+ int multicastGroupPort,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions)
+Constructs a new NetMarshalClient with the specified
+MulticastSocket , multicast group InetAddress , multicast port, IPacketFactory , PacketLoader and FragmentationOptions . |
+
NetMarshalClient(java.net.Socket socketIn,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions)
+Constructs a new NetMarshalClient with the specified
+Socket , IPacketFactory , PacketLoader and FragmentationOptions . |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+arePacketsBeingRead()
+Are
+IPacket s being read. |
+
boolean |
+areReceivedPacketsWaiting()
+Gets if there are received
+IPacket s. |
+
void |
+clearFragmentStorage()
+Clears the fragment storage registries if fragmentation is enabled.
+ |
+
void |
+close()
+Closes the marshal, closing all its streams.
+ |
+
void |
+flush()
+Flushes the output streams.
+ |
+
java.util.function.Consumer<NetMarshalClient> |
+getClosedConsumer()
+Gets the
+Consumer closed consumer. |
+
FragmentationOptions |
+getFragmentationOptions()
+Gets the
+FragmentationOptions of the client. |
+
java.io.InputStream |
+getInputStream()
+Get the input stream.
+ |
+
java.io.OutputStream |
+getOutputStream()
+Get the output stream.
+ |
+
IPacketFactory |
+getPacketFactory()
+Gets the packet factory in use.
+ |
+
PacketLoader |
+getPacketLoader()
+Gets the packet loader in use.
+ |
+
java.util.function.BiConsumer<IPacket,NetMarshalClient> |
+getReceiveBiConsumer()
+Gets the
+BiConsumer receiver consumer. |
+
java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> |
+getReceiveExceptionBiConsumer()
+Gets the
+BiConsumer receive exception consumer. |
+
java.io.InputStream |
+getRootInputStream()
+Get the root input stream.
+ |
+
java.io.OutputStream |
+getRootOutputStream()
+Get the root output stream.
+ |
+
boolean |
+isRunning()
+Gets if the marshal is running.
+ |
+
boolean |
+isSSLUpgraded()
+Gets if the marshal is ssl upgraded.
+ |
+
java.net.InetAddress |
+localAddress()
+Get the local
+InetAddress . |
+
int |
+localPort()
+Get the local port.
+ |
+
void |
+open()
+Opens the marshal.
+ |
+
IPacket |
+receivePacket()
+Receives a
+IPacket . |
+
IPacket |
+receivePacketPolled()
+Receives a
+IPacket polled. |
+
java.net.InetAddress |
+remoteAddress()
+Get the remote
+InetAddress . |
+
int |
+remotePort()
+Get the remote port.
+ |
+
void |
+sendPacket(IPacket packetIn,
+ boolean directSend)
+Sends a
+IPacket . |
+
void |
+setClosedConsumer(java.util.function.Consumer<NetMarshalClient> consumer)
+Sets the
+Consumer closed consumer. |
+
void |
+setPacketsShouldBeRead(boolean shouldRead)
+Set if
+IPacket s should be read. |
+
void |
+setReceiveBiConsumer(java.util.function.BiConsumer<IPacket,NetMarshalClient> consumer)
+Sets the
+BiConsumer receiver consumer. |
+
void |
+setReceiveExceptionBiConsumer(java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> consumer)
+Sets the
+BiConsumer receive exception consumer. |
+
void |
+sslUpgradeClientSide(javax.net.ssl.SSLContext context,
+ java.lang.String remoteHostName)
+Performs SSL socket upgrades on client side (Use for constructed sockets).
+ |
+
void |
+sslUpgradeServerSide(javax.net.ssl.SSLContext context)
+Performs SSL socket upgrades on server side (Use for accepted sockets).
+ |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetMarshalClient(java.net.Socket socketIn, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions)+
Socket
, IPacketFactory
, PacketLoader
and FragmentationOptions
.socketIn
- The socket to use.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.java.lang.NullPointerException
- socketIn, factory or loader is null.java.lang.IllegalArgumentException
- Fragmentation options failed validation.public NetMarshalClient(java.net.MulticastSocket socketIn, + java.net.InetAddress multicastGroupAddress, + int multicastGroupPort, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions) + throws java.io.IOException+
MulticastSocket
, multicast group InetAddress
, multicast port, IPacketFactory
, PacketLoader
and FragmentationOptions
.
+ The MulticastSocket
will join the multicast group.socketIn
- The multicast socket to use.multicastGroupAddress
- The multicast group address.multicastGroupPort
- The multicast group port.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.java.io.IOException
- There is an error joining or multicastGroupAddress is not a multicast address.java.lang.NullPointerException
- socketIn, multicastGroupAddress, factory or loader is null.java.lang.IllegalArgumentException
- multicastGroupPort is less than 0 or greater than 65535 or fragmentation options failed validation.public NetMarshalClient(java.net.DatagramSocket socketIn, + java.net.InetAddress remoteAddress, + int remotePort, + java.io.InputStream inputStream, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions)+
DatagramSocket
, remote InetAddress
, remote port, InputStream
, IPacketFactory
, PacketLoader
and FragmentationOptions
.socketIn
- The datagram socket to use.remoteAddress
- The remote address to send data to.remotePort
- The remote port to send data to.inputStream
- The receiving input stream.factory
- The packet factory to use.loader
- The loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.java.lang.NullPointerException
- socketIn, remoteAddress, inputStream, factory or loader is null.java.lang.IllegalArgumentException
- remotePort is less than 0 or greater than 65535 or fragmentation options failed validation.public NetMarshalClient(java.net.DatagramSocket socketIn, + java.net.InetAddress remoteAddress, + int remotePort, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions)+
DatagramSocket
, remote InetAddress
, remote port, IPacketFactory
, PacketLoader
and FragmentationOptions
.socketIn
- The datagram socket to use.remoteAddress
- The remote address to send data to.remotePort
- The remote port to send data to.factory
- The packet factory to use.loader
- The loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.java.lang.NullPointerException
- socketIn, remoteAddress, factory or loader is null.java.lang.IllegalArgumentException
- remotePort is less than 0 or greater than 65535 or fragmentation options failed validation.public final void open()+
public java.io.InputStream getInputStream()+
public java.io.InputStream getRootInputStream()+
public java.io.OutputStream getOutputStream()+
public java.io.OutputStream getRootOutputStream()+
public IPacketFactory getPacketFactory()+
public PacketLoader getPacketLoader()+
public final void clearFragmentStorage()+
public java.net.InetAddress localAddress()+
InetAddress
.public int localPort()+
public java.net.InetAddress remoteAddress()+
InetAddress
.public int remotePort()+
public final boolean isRunning()+
public FragmentationOptions getFragmentationOptions()+
FragmentationOptions
of the client.public final boolean isSSLUpgraded()+
public final void sendPacket(IPacket packetIn, + boolean directSend) + throws java.io.IOException, + PacketException+
IPacket
.packetIn
- The packet to send.directSend
- Whether the packet should be sent directly or through the fragmentation system.java.io.IOException
- A stream exception has occurred.PacketException
- An exception has occurred.java.lang.NullPointerException
- packetIn is null.public final void flush() + throws java.io.IOException+
java.io.IOException
- A stream exception has occurred.public boolean areReceivedPacketsWaiting()+
IPacket
s.public IPacket receivePacket() + throws java.lang.InterruptedException+
IPacket
.java.lang.InterruptedException
- A thread interruption has occurred.public IPacket receivePacketPolled()+
IPacket
polled.public boolean arePacketsBeingRead()+
IPacket
s being read.public void setPacketsShouldBeRead(boolean shouldRead)+
IPacket
s should be read.shouldRead
- Should packets be read.public void sslUpgradeServerSide(javax.net.ssl.SSLContext context) + throws SSLUtilityException, + java.io.IOException+
setPacketsShouldBeRead(boolean)
is set to false or in a BiConsumer
+ consumer for setReceiveBiConsumer(BiConsumer)
.context
- The SSL context to use.SSLUtilityException
- An SSL Utility exception has occurred.java.io.IOException
- An I/O Exception has occurred.java.lang.NullPointerException
- context is null.java.lang.IllegalStateException
- sslUpgrade methods should be called in a BiConsumer (for setReceiveBiConsumer)
+ within the target NetMarshalClient or when reading packets (arePacketsBeingRead) is disabled on the NetMarshalClient.public void sslUpgradeClientSide(javax.net.ssl.SSLContext context, + java.lang.String remoteHostName) + throws SSLUtilityException, + java.io.IOException+
setPacketsShouldBeRead(boolean)
is set to false or in a BiConsumer
+ consumer for setReceiveBiConsumer(BiConsumer)
.context
- The SSL context to use.remoteHostName
- The hostname of the remote server.SSLUtilityException
- An SSL Utility exception has occurred.java.io.IOException
- An I/O Exception has occurred.java.lang.NullPointerException
- context or remoteHostName is null.java.lang.IllegalStateException
- sslUpgrade methods should be called in a BiConsumer (for setReceiveBiConsumer)
+ within the target NetMarshalClient or when reading packets (arePacketsBeingRead) is disabled on the NetMarshalClient.public java.util.function.BiConsumer<IPacket,NetMarshalClient> getReceiveBiConsumer()+
BiConsumer
receiver consumer.
+ WARNING: Calling sendPacket(IPacket, boolean)
or flush()
could cause full buffer hangs.public void setReceiveBiConsumer(java.util.function.BiConsumer<IPacket,NetMarshalClient> consumer)+
BiConsumer
receiver consumer.
+ WARNING: Calling sendPacket(IPacket, boolean)
or flush()
could cause full buffer hangs.consumer
- The new receiver consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> getReceiveExceptionBiConsumer()+
BiConsumer
receive exception consumer.public void setReceiveExceptionBiConsumer(java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> consumer)+
BiConsumer
receive exception consumer.consumer
- The new exception consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.Consumer<NetMarshalClient> getClosedConsumer()+
Consumer
closed consumer.public void setClosedConsumer(java.util.function.Consumer<NetMarshalClient> consumer)+
Consumer
closed consumer.consumer
- The new closed consumer.java.lang.NullPointerException
- consumer is null.public final void close() + throws java.io.IOException+
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
- An I/O Exception has occurred.public class NetMarshalClientWrapped +extends NetMarshalClient+
Constructor and Description | +
---|
NetMarshalClientWrapped(java.net.DatagramSocket socketIn,
+ java.net.InetAddress remoteAddress,
+ int remotePort,
+ java.io.InputStream inputStream,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions,
+ java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper,
+ java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)
+Constructs a new NetMarshalClientWrapped with the specified
+DatagramSocket , remote InetAddress , remote port, InputStream , IPacketFactory ,
+ PacketLoader , FragmentationOptions , Function for wrapping the input stream and the Function for wrapping the output stream. |
+
NetMarshalClientWrapped(java.net.DatagramSocket socketIn,
+ java.net.InetAddress remoteAddress,
+ int remotePort,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions,
+ java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper,
+ java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)
+Constructs a new NetMarshalClientWrapped with the specified
+DatagramSocket , remote InetAddress , remote port, IPacketFactory ,
+ PacketLoader , FragmentationOptions , Function for wrapping the input stream and the Function for wrapping the output stream. |
+
NetMarshalClientWrapped(java.net.MulticastSocket socketIn,
+ java.net.InetAddress multicastGroupAddress,
+ int multicastGroupPort,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions,
+ java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper,
+ java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)
+Constructs a new NetMarshalClientWrapped with the specified
+MulticastSocket , multicast group InetAddress , multicast port, IPacketFactory ,
+ PacketLoader , FragmentationOptions , Function for wrapping the input stream and the Function for wrapping the output stream. |
+
NetMarshalClientWrapped(java.net.Socket socketIn,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions,
+ java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper,
+ java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)
+Constructs a new NetMarshalClientWrapped with the specified
+Socket , IPacketFactory ,
+ PacketLoader , FragmentationOptions , Function for wrapping the input stream and the Function for wrapping the output stream. |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.function.Function<java.io.InputStream,java.io.InputStream> |
+getWrapperInputStream()
+Gets the
+Function input stream wrapper function. |
+
java.util.function.Function<java.io.OutputStream,java.io.OutputStream> |
+getWrapperOutputStream()
+Gets the
+Function output stream wrapper function. |
+
arePacketsBeingRead, areReceivedPacketsWaiting, clearFragmentStorage, close, flush, getClosedConsumer, getFragmentationOptions, getInputStream, getOutputStream, getPacketFactory, getPacketLoader, getReceiveBiConsumer, getReceiveExceptionBiConsumer, getRootInputStream, getRootOutputStream, isRunning, isSSLUpgraded, localAddress, localPort, open, receivePacket, receivePacketPolled, remoteAddress, remotePort, sendPacket, setClosedConsumer, setPacketsShouldBeRead, setReceiveBiConsumer, setReceiveExceptionBiConsumer, sslUpgradeClientSide, sslUpgradeServerSide
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetMarshalClientWrapped(java.net.Socket socketIn, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions, + java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper, + java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)+
Socket
, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.
+ Wrapped streams should close the underlying stream when closed.socketIn
- The socket to use.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.inputStreamWrapper
- The input stream wrapper to use (Can be null).outputStreamWrapper
- The output stream wrapper to use (Can be null).java.lang.NullPointerException
- socketIn, factory or loader is null.java.lang.IllegalArgumentException
- Fragmentation options failed validation.public NetMarshalClientWrapped(java.net.MulticastSocket socketIn, + java.net.InetAddress multicastGroupAddress, + int multicastGroupPort, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions, + java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper, + java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper) + throws java.io.IOException+
MulticastSocket
, multicast group InetAddress
, multicast port, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.
+ The MulticastSocket
will join the multicast group.
+ Wrapped streams should close the underlying stream when closed.socketIn
- The multicast socket to use.multicastGroupAddress
- The multicast group address.multicastGroupPort
- The multicast group port.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.inputStreamWrapper
- The input stream wrapper to use (Can be null).outputStreamWrapper
- The output stream wrapper to use (Can be null).java.io.IOException
- There is an error joining or multicastGroupAddress is not a multicast address.java.lang.NullPointerException
- socketIn, multicastGroupAddress, factory or loader is null.java.lang.IllegalArgumentException
- multicastGroupPort is less than 0 or greater than 65535 or fragmentation options failed validation.public NetMarshalClientWrapped(java.net.DatagramSocket socketIn, + java.net.InetAddress remoteAddress, + int remotePort, + java.io.InputStream inputStream, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions, + java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper, + java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)+
DatagramSocket
, remote InetAddress
, remote port, InputStream
, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.
+ Wrapped streams should close the underlying stream when closed.socketIn
- The datagram socket to use.remoteAddress
- The remote address to send data to.remotePort
- The remote port to send data to.inputStream
- The receiving input stream.factory
- The packet factory to use.loader
- The loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.inputStreamWrapper
- The input stream wrapper to use (Can be null).outputStreamWrapper
- The output stream wrapper to use (Can be null).java.lang.NullPointerException
- socketIn, remoteAddress, inputStream, factory or loader is null.java.lang.IllegalArgumentException
- remotePort is less than 0 or greater than 65535 or fragmentation options failed validation.public NetMarshalClientWrapped(java.net.DatagramSocket socketIn, + java.net.InetAddress remoteAddress, + int remotePort, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions, + java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper, + java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)+
DatagramSocket
, remote InetAddress
, remote port, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.
+ Wrapped streams should close the underlying stream when closed.socketIn
- The datagram socket to use.remoteAddress
- The remote address to send data to.remotePort
- The remote port to send data to.factory
- The packet factory to use.loader
- The loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.inputStreamWrapper
- The input stream wrapper to use (Can be null).outputStreamWrapper
- The output stream wrapper to use (Can be null).java.lang.NullPointerException
- socketIn, remoteAddress, factory or loader is null.java.lang.IllegalArgumentException
- remotePort is less than 0 or greater than 65535 or fragmentation options failed validation.public java.util.function.Function<java.io.InputStream,java.io.InputStream> getWrapperInputStream()+
Function
input stream wrapper function.public java.util.function.Function<java.io.OutputStream,java.io.OutputStream> getWrapperOutputStream()+
Function
output stream wrapper function.public class NetMarshalServer
+extends java.lang.Object
+implements java.io.Closeable
+NetMarshalClient
s.
+ NOTE: Methods that are synchronised are used here, do NOT use instances of these classes as monitors.Constructor and Description | +
---|
NetMarshalServer(java.net.DatagramSocket socketIn,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions)
+Constructs a new NetMarshalServer with the specified
+DatagramSocket , IPacketFactory , PacketLoader and FragmentationOptions . |
+
NetMarshalServer(java.net.ServerSocket socketIn,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions)
+Constructs a new NetMarshalServer with the specified
+ServerSocket , IPacketFactory , PacketLoader and FragmentationOptions . |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+broadcastPacket(IPacket packetIn,
+ boolean directSend)
+Broadcasts a
+IPacket . |
+
void |
+close()
+Closes the marshal, closing all the connected clients.
+ |
+
NetMarshalClient |
+connect(java.net.InetAddress remoteAddress,
+ int remotePort,
+ int timeout)
+Connects to a remote endpoint.
+ |
+
void |
+disconnectAll()
+Disconnects all the clients (By closing them).
+ |
+
void |
+flush()
+Flushes all the output streams on all the clients.
+ |
+
java.util.function.BiConsumer<java.lang.Exception,NetMarshalServer> |
+getAcceptExceptionBiConsumer()
+Gets the
+BiConsumer accept exception consumer. |
+
java.util.function.BiConsumer<CandidateClient,NetMarshalServer> |
+getClientAcceptanceBiConsumer()
+Gets the
+BiConsumer client acceptance consumer. |
+
java.util.function.Consumer<NetMarshalClient> |
+getClosedConsumer()
+Gets the
+Consumer closed consumer. |
+
NetMarshalClient[] |
+getConnectedClients()
+Gets the current set of connected
+NetMarshalClient s. |
+
FragmentationOptions |
+getFragmentationOptions()
+Gets the
+FragmentationOptions of the client. |
+
java.util.function.Consumer<NetMarshalClient> |
+getOpenedConsumer()
+Gets the
+Consumer opened consumer. |
+
IPacketFactory |
+getPacketFactory()
+Gets the packet factory in use.
+ |
+
PacketLoader |
+getPacketLoader()
+Gets the packet loader in use.
+ |
+
java.util.function.BiConsumer<IPacket,NetMarshalClient> |
+getReceiveBiConsumer()
+Gets the
+BiConsumer receiver consumer. |
+
java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> |
+getReceiveExceptionBiConsumer()
+Gets the
+BiConsumer receive exception consumer. |
+
java.util.function.BiConsumer<java.net.Socket,NetMarshalServer> |
+getSocketSetupBiConsumer()
+Gets the
+BiConsumer socket setup consumer. |
+
boolean |
+isRunning()
+Gets if the marshal is running.
+ |
+
java.net.InetAddress |
+localAddress()
+Get the local
+InetAddress . |
+
int |
+localPort()
+Get the local port.
+ |
+
void |
+open()
+Opens the marshal.
+ |
+
void |
+setAcceptExceptionBiConsumer(java.util.function.BiConsumer<java.lang.Exception,NetMarshalServer> consumer)
+Sets the
+BiConsumer accept exception consumer. |
+
void |
+setClientAcceptanceBiConsumer(java.util.function.BiConsumer<CandidateClient,NetMarshalServer> consumer)
+Sets the
+BiConsumer client acceptance consumer. |
+
void |
+setClosedConsumer(java.util.function.Consumer<NetMarshalClient> consumer)
+Sets the
+Consumer closed consumer. |
+
void |
+setOpenedConsumer(java.util.function.Consumer<NetMarshalClient> consumer)
+Sets the
+Consumer opened consumer. |
+
void |
+setReceiveBiConsumer(java.util.function.BiConsumer<IPacket,NetMarshalClient> consumer)
+Sets the
+BiConsumer receiver consumer. |
+
void |
+setReceiveExceptionBiConsumer(java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> consumer)
+Sets the
+BiConsumer receive exception consumer. |
+
void |
+setSocketSetupBiConsumer(java.util.function.BiConsumer<java.net.Socket,NetMarshalServer> consumer)
+Sets the
+BiConsumer socket setup consumer. |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetMarshalServer(java.net.ServerSocket socketIn, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions)+
ServerSocket
, IPacketFactory
, PacketLoader
and FragmentationOptions
.socketIn
- The server socket to use.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.java.lang.NullPointerException
- socketIn, factory or loader is null.java.lang.IllegalArgumentException
- Fragmentation options failed validation.public NetMarshalServer(java.net.DatagramSocket socketIn, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions)+
DatagramSocket
, IPacketFactory
, PacketLoader
and FragmentationOptions
.socketIn
- The datagram socket to use.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.java.lang.NullPointerException
- socketIn, factory or loader is null.java.lang.IllegalArgumentException
- Fragmentation options failed validation.public final void open()+
public IPacketFactory getPacketFactory()+
public PacketLoader getPacketLoader()+
public java.net.InetAddress localAddress()+
InetAddress
.public int localPort()+
public final boolean isRunning()+
public FragmentationOptions getFragmentationOptions()+
FragmentationOptions
of the client.public final NetMarshalClient[] getConnectedClients()+
NetMarshalClient
s.public final void broadcastPacket(IPacket packetIn, + boolean directSend) + throws java.io.IOException, + PacketException+
IPacket
.packetIn
- The packet to broadcast.directSend
- Whether the packet should be sent directly or through the fragmentation system.java.io.IOException
- A stream exception has occurred.PacketException
- An exception has occurred.java.lang.NullPointerException
- packetIn is null.public final void flush() + throws java.io.IOException+
java.io.IOException
- A stream exception has occurred.public final void disconnectAll() + throws java.io.IOException+
java.io.IOException
- An I/O Exception has occurred.public java.util.function.BiConsumer<IPacket,NetMarshalClient> getReceiveBiConsumer()+
BiConsumer
receiver consumer.
+ WARNING: Calling broadcastPacket(IPacket, boolean)
or flush()
could cause full buffer hangs.public void setReceiveBiConsumer(java.util.function.BiConsumer<IPacket,NetMarshalClient> consumer)+
BiConsumer
receiver consumer.
+ WARNING: Calling broadcastPacket(IPacket, boolean)
or flush()
could cause full buffer hangs.consumer
- The new receiver consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> getReceiveExceptionBiConsumer()+
BiConsumer
receive exception consumer.public void setReceiveExceptionBiConsumer(java.util.function.BiConsumer<java.lang.Exception,NetMarshalClient> consumer)+
BiConsumer
receive exception consumer.consumer
- The new exception consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.BiConsumer<java.lang.Exception,NetMarshalServer> getAcceptExceptionBiConsumer()+
BiConsumer
accept exception consumer.public void setAcceptExceptionBiConsumer(java.util.function.BiConsumer<java.lang.Exception,NetMarshalServer> consumer)+
BiConsumer
accept exception consumer.consumer
- The new exception consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.Consumer<NetMarshalClient> getClosedConsumer()+
Consumer
closed consumer.public void setClosedConsumer(java.util.function.Consumer<NetMarshalClient> consumer)+
Consumer
closed consumer.consumer
- The new closed consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.Consumer<NetMarshalClient> getOpenedConsumer()+
Consumer
opened consumer.public void setOpenedConsumer(java.util.function.Consumer<NetMarshalClient> consumer)+
Consumer
opened consumer.consumer
- The new opened consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.BiConsumer<CandidateClient,NetMarshalServer> getClientAcceptanceBiConsumer()+
BiConsumer
client acceptance consumer.
+ Use CandidateClient.accept
to declare whether the candidate should be accepted.public void setClientAcceptanceBiConsumer(java.util.function.BiConsumer<CandidateClient,NetMarshalServer> consumer)+
BiConsumer
client acceptance consumer.
+ Use CandidateClient.accept
to declare whether the candidate should be accepted.consumer
- The new acceptance consumer.java.lang.NullPointerException
- consumer is null.public java.util.function.BiConsumer<java.net.Socket,NetMarshalServer> getSocketSetupBiConsumer()+
BiConsumer
socket setup consumer.public void setSocketSetupBiConsumer(java.util.function.BiConsumer<java.net.Socket,NetMarshalServer> consumer)+
BiConsumer
socket setup consumer.consumer
- The new setup consumer.java.lang.NullPointerException
- consumer is null.public final NetMarshalClient connect(java.net.InetAddress remoteAddress, + int remotePort, + int timeout) + throws java.io.IOException+
remoteAddress
- The remote address to connect to.remotePort
- The remote port to connect to.timeout
- The timeout of the connection attempt (0 for infinite timeout).java.io.IOException
- A connection error has occurred.public final void close() + throws java.io.IOException+
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
- An I/O Exception has occurred.public class NetMarshalServerWrapped +extends NetMarshalServer+
NetMarshalClient
s, allows stream wrapping.
+ Wrapped streams should close the underlying stream when closed.
+ NOTE: Methods that are synchronised are used here, do NOT use instances of these classes as monitors.Constructor and Description | +
---|
NetMarshalServerWrapped(java.net.DatagramSocket socketIn,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions,
+ java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper,
+ java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)
+Constructs a new NetMarshalServerWrapped with the specified
+DatagramSocket , IPacketFactory , PacketLoader , FragmentationOptions ,
+ Function for wrapping the input stream and the Function for wrapping the output stream. |
+
NetMarshalServerWrapped(java.net.ServerSocket socketIn,
+ IPacketFactory factory,
+ PacketLoader loader,
+ FragmentationOptions fragmentationOptions,
+ java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper,
+ java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)
+Constructs a new NetMarshalServerWrapped with the specified
+ServerSocket , IPacketFactory , PacketLoader , FragmentationOptions ,
+ Function for wrapping the input stream and the Function for wrapping the output stream. |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.function.Function<java.io.InputStream,java.io.InputStream> |
+getWrapperInputStream()
+Gets the
+Function input stream wrapper function. |
+
java.util.function.Function<java.io.OutputStream,java.io.OutputStream> |
+getWrapperOutputStream()
+Gets the
+Function output stream wrapper function. |
+
broadcastPacket, close, connect, disconnectAll, flush, getAcceptExceptionBiConsumer, getClientAcceptanceBiConsumer, getClosedConsumer, getConnectedClients, getFragmentationOptions, getOpenedConsumer, getPacketFactory, getPacketLoader, getReceiveBiConsumer, getReceiveExceptionBiConsumer, getSocketSetupBiConsumer, isRunning, localAddress, localPort, open, setAcceptExceptionBiConsumer, setClientAcceptanceBiConsumer, setClosedConsumer, setOpenedConsumer, setReceiveBiConsumer, setReceiveExceptionBiConsumer, setSocketSetupBiConsumer
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetMarshalServerWrapped(java.net.ServerSocket socketIn, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions, + java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper, + java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)+
ServerSocket
, IPacketFactory
, PacketLoader
, FragmentationOptions
,
+ Function
for wrapping the input stream and the Function
for wrapping the output stream.socketIn
- The server socket to use.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.inputStreamWrapper
- The input stream wrapper to use (Can be null).outputStreamWrapper
- The output stream wrapper to use (Can be null).java.lang.NullPointerException
- socketIn, factory or loader is null.java.lang.IllegalArgumentException
- Fragmentation options failed validation.public NetMarshalServerWrapped(java.net.DatagramSocket socketIn, + IPacketFactory factory, + PacketLoader loader, + FragmentationOptions fragmentationOptions, + java.util.function.Function<java.io.InputStream,java.io.InputStream> inputStreamWrapper, + java.util.function.Function<java.io.OutputStream,java.io.OutputStream> outputStreamWrapper)+
DatagramSocket
, IPacketFactory
, PacketLoader
, FragmentationOptions
,
+ Function
for wrapping the input stream and the Function
for wrapping the output stream.socketIn
- The datagram socket to use.factory
- The packet factory to use.loader
- The packet loader to use.fragmentationOptions
- The fragmentation options, null to disable fragmentation.inputStreamWrapper
- The input stream wrapper to use (Can be null).outputStreamWrapper
- The output stream wrapper to use (Can be null).java.lang.NullPointerException
- socketIn, factory or loader is null.java.lang.IllegalArgumentException
- Fragmentation options failed validation.public java.util.function.Function<java.io.InputStream,java.io.InputStream> getWrapperInputStream()+
Function
input stream wrapper function.public java.util.function.Function<java.io.OutputStream,java.io.OutputStream> getWrapperOutputStream()+
Function
output stream wrapper function.IPacket
s on sockets.See: Description
+Class | +Description | +
---|---|
CandidateClient | +
+ This class provides a candidate client for
+NetMarshalServer s. |
+
FragmentationOptions | +
+ This class provides fragmentation options for using
+FragmentSender s and
+ FragmentReceiver s in this package. |
+
NetMarshalClient | +
+ This class provides a managed way of networking on the client side.
+ |
+
NetMarshalClientWrapped | +
+ This class provides a managed way of networking on the client side, allows stream wrapping.
+ |
+
NetMarshalServer | +
+ This class provides a way of networking on the server side and holds a collection of
+NetMarshalClient s. |
+
NetMarshalServerWrapped | +
+ This class provides a way of networking on the server side and holds a collection of
+NetMarshalClient s, allows stream wrapping. |
+
IPacket
s on sockets.public interface IAcknowledgement
+Modifier and Type | +Method and Description | +
---|---|
boolean |
+isAcknowledgement()
+Gets if the class instance is an Acknowledgement.
+ |
+
public interface IInternalCache
+Modifier and Type | +Method and Description | +
---|---|
boolean |
+isCacheUsed()
+Gets if the internal cache is used.
+ |
+
void |
+setCacheUsed(boolean used)
+Sets if the internal cache is used.
+ |
+
boolean isCacheUsed()+
void setCacheUsed(boolean used)+
used
- If the internal cache is used.public interface IPacket
+Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
boolean isValid()+
PacketProtocolInformation getProtocol()+
byte[] savePayload() + throws PacketException+
PacketException
- An Exception has occurred.void loadPayload(byte[] packetData) + throws PacketException+
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public interface IStreamedPacket +extends IPacket+
Modifier and Type | +Method and Description | +
---|---|
int |
+getSize()
+Gets the size of the output data.
+ |
+
void |
+readData(java.io.OutputStream outputStream)
+Reads payload data to an
+OutputStream . |
+
void |
+writeData(java.io.InputStream inputStream,
+ int size)
+Writes payload data from an
+InputStream . |
+
getProtocol, isValid, loadPayload, savePayload
void readData(java.io.OutputStream outputStream) + throws java.io.IOException, + PacketException+
OutputStream
.outputStream
- The output stream to read data to.java.lang.NullPointerException
- outputStream is null.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.void writeData(java.io.InputStream inputStream, + int size) + throws java.io.IOException, + PacketException+
InputStream
.inputStream
- The input stream to write data from.size
- The size of the input payload in bytes.java.lang.NullPointerException
- inputStream is null.java.lang.IllegalArgumentException
- size is less than 0.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.int getSize() + throws PacketException+
PacketException
- An Exception has occurred.public class PacketException
+extends java.lang.Exception
+Throwable.getCause()
to find out the underlying exception.Constructor and Description | +
---|
PacketException(java.lang.String message)
+Constructs a new exception with the specified detail message.
+ |
+
PacketException(java.lang.String message,
+ java.lang.Throwable cause)
+Constructs a new exception with the specified detail message and
+ cause.
+ |
+
PacketException(java.lang.Throwable cause)
+Constructs a new exception with the specified cause and a detail
+ message of (cause==null ? null : cause.toString()) (which
+ typically contains the class and detail message of cause).
+ |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public PacketException(java.lang.String message)+
Throwable.initCause(java.lang.Throwable)
.message
- the detail message. The detail message is saved for
+ later retrieval by the Throwable.getMessage()
method.public PacketException(java.lang.String message, + java.lang.Throwable cause)+
Note that the detail message associated with
+ cause
is not automatically incorporated in
+ this exception's detail message.
message
- the detail message (which is saved for later retrieval
+ by the Throwable.getMessage()
method).cause
- the cause (which is saved for later retrieval by the
+ Throwable.getCause()
method). (A null value is
+ permitted, and indicates that the cause is nonexistent or
+ unknown.)public PacketException(java.lang.Throwable cause)+
PrivilegedActionException
).cause
- the cause (which is saved for later retrieval by the
+ Throwable.getCause()
method). (A null value is
+ permitted, and indicates that the cause is nonexistent or
+ unknown.)public class PacketLoader
+extends java.lang.Object
+IPacket
+ to InputStream
and OutputStream
.
+ Packets can have contents checking support using DigestProvider
.Constructor and Description | +
---|
PacketLoader()
+Constructs a new Packet loader instance.
+ |
+
PacketLoader(com.captainalm.lib.stdcrypt.digest.DigestProvider provider)
+Constructs a new Packet loader instance with the specified
+DigestProvider . |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+areInvalidPacketsAllowed()
+Gets whether invalid packets are allowed to be read and written.
+ |
+
static byte[] |
+getByteArrayFromInteger(int i)
+Saves an Integer into a byte array.
+ |
+
com.captainalm.lib.stdcrypt.digest.DigestProvider |
+getHashProvider()
+This field provides the
+DigestProvider to use for the payload of the packets on the trailer. |
+
static int |
+getIntegerFromByteArray(byte[] bytes)
+Loads an Integer from a byte array.
+ |
+
int |
+getPacketSize(IPacket packet,
+ boolean includeInformation,
+ boolean ignoreDigest)
+Gets the total size of a written packet in bytes.
+ |
+
static byte[] |
+readArrayFromInputStream(java.io.InputStream inputStream,
+ int length)
+Reads in a byte array of a specified length from an
+InputStream . |
+
static byte |
+readByteFromInputStream(java.io.InputStream inputStream)
+Reads a byte from an
+InputStream . |
+
static int |
+readInteger(java.io.InputStream inputStream)
+Reads an Integer from an
+InputStream . |
+
IPacket |
+readPacket(java.io.InputStream inputStream,
+ IPacketFactory factory,
+ PacketProtocolInformation information)
+Reads a
+IPacket from an input stream. |
+
IPacket |
+readPacketNoDigest(byte[] arrayIn,
+ IPacketFactory factory,
+ PacketProtocolInformation information)
+Reads a
+IPacket from a byte array (No digest support). |
+
IPacket |
+readPacketNoDigest(java.io.InputStream inputStream,
+ IPacketFactory factory,
+ PacketProtocolInformation information)
+Reads a
+IPacket from an input stream (No digest support). |
+
IPacket |
+readStreamedPacket(java.io.InputStream inputStream,
+ IPacketFactory factory,
+ PacketProtocolInformation information)
+Reads a
+IStreamedPacket from an input stream. |
+
IPacket |
+readStreamedPacketNoDigest(java.io.InputStream inputStream,
+ IPacketFactory factory,
+ PacketProtocolInformation information)
+Reads a
+IStreamedPacket from an input stream (No digest support). |
+
void |
+setAllowInvalidPackets(boolean allowInvalidPackets)
+This sets whether invalid packets are allowed to be read and written.
+ |
+
static void |
+writeInteger(java.io.OutputStream outputStream,
+ int i)
+Writes an Integer to the
+OutputStream using 4 bytes. |
+
void |
+writePacket(java.io.OutputStream outputStream,
+ IPacket packet,
+ boolean writeInformation)
+Writes a
+IPacket to an output stream (No digest support). |
+
byte[] |
+writePacketNoDigest(IPacket packet,
+ boolean writeInformation)
+Returns a
+IPacket to a byte array (No digest support). |
+
void |
+writePacketNoDigest(java.io.OutputStream outputStream,
+ IPacket packet,
+ boolean writeInformation)
+Writes a
+IPacket to an output stream. |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public PacketLoader()+
PacketLoader(DigestProvider)
public PacketLoader(com.captainalm.lib.stdcrypt.digest.DigestProvider provider)+
DigestProvider
.
+ If using a digest provider, make sure all endpoints use the same algorithm;
+ if null, no trailer is created or expected;
+ this is ignored if saving / loading packets from byte arrays.provider
- The digest provider or null.public com.captainalm.lib.stdcrypt.digest.DigestProvider getHashProvider()+
DigestProvider
to use for the payload of the packets on the trailer.public boolean areInvalidPacketsAllowed()+
public void setAllowInvalidPackets(boolean allowInvalidPackets)+
allowInvalidPackets
- If invalid packets can be processed.public IPacket readPacketNoDigest(byte[] arrayIn, + IPacketFactory factory, + PacketProtocolInformation information) + throws PacketException+
IPacket
from a byte array (No digest support).
+ If the information parameter is null, this is obtained as part of the reading.
+ NOTE: The getHashProvider()
for digests is NOT supported and no digest is expected for these packets.arrayIn
- The byte array for reading.factory
- The IPacketFactory
to use to generate packets.information
- The protocol information or null.java.lang.NullPointerException
- The arrayIn or the factory is null.PacketException
- An Exception has occurred.public IPacket readPacket(java.io.InputStream inputStream, + IPacketFactory factory, + PacketProtocolInformation information) + throws java.io.IOException, + PacketException+
IPacket
from an input stream.
+ If the information parameter is null, this is obtained as part of the reading.inputStream
- The input stream for reading.factory
- The IPacketFactory
to use to generate packets.information
- The protocol information or null.java.lang.NullPointerException
- The inputStream or the factory is null.java.io.IOException
- A stream exception occurs.PacketException
- An Exception has occurred.public IPacket readPacketNoDigest(java.io.InputStream inputStream, + IPacketFactory factory, + PacketProtocolInformation information) + throws java.io.IOException, + PacketException+
IPacket
from an input stream (No digest support).
+ If the information parameter is null, this is obtained as part of the reading.
+ NOTE: The getHashProvider()
for digests is NOT supported and no digest is expected for these packets.inputStream
- The input stream for reading.factory
- The IPacketFactory
to use to generate packets.information
- The protocol information or null.java.lang.NullPointerException
- The inputStream or the factory is null.java.io.IOException
- A stream exception occurs.PacketException
- An Exception has occurred.public IPacket readStreamedPacket(java.io.InputStream inputStream, + IPacketFactory factory, + PacketProtocolInformation information) + throws java.io.IOException, + PacketException+
IStreamedPacket
from an input stream.
+ If the information parameter is null, this is obtained as part of the reading.
+ NOTE: The packet may be an IPacket
if no stream packet is available for that protocol.inputStream
- The input stream for reading.factory
- The IPacketFactory
to use to generate packets.information
- The protocol information or null.java.lang.NullPointerException
- The inputStream or the factory is null.java.io.IOException
- A stream exception occurs.PacketException
- An Exception has occurred.public IPacket readStreamedPacketNoDigest(java.io.InputStream inputStream, + IPacketFactory factory, + PacketProtocolInformation information) + throws java.io.IOException, + PacketException+
IStreamedPacket
from an input stream (No digest support).
+ If the information parameter is null, this is obtained as part of the reading.
+ NOTE: The packet may be an IPacket
if no stream packet is available for that protocol.
+ NOTE: The getHashProvider()
for digests is NOT supported and no digest is expected for these packets.inputStream
- The input stream for reading.factory
- The IPacketFactory
to use to generate packets.information
- The protocol information or null.java.lang.NullPointerException
- The inputStream or the factory is null.java.io.IOException
- A stream exception occurs.PacketException
- An Exception has occurred.public byte[] writePacketNoDigest(IPacket packet, + boolean writeInformation) + throws PacketException+
IPacket
to a byte array (No digest support).
+ NOTE: The getHashProvider()
for digests is NOT supported and no digest is expected for these packets.packet
- The packet to save.writeInformation
- Write the PacketProtocolInformation
to the beginning of the array.java.lang.NullPointerException
- A parameter is null.PacketException
- An Exception has occurred.public void writePacket(java.io.OutputStream outputStream, + IPacket packet, + boolean writeInformation) + throws java.io.IOException, + PacketException+
IPacket
to an output stream (No digest support).outputStream
- The output stream for writing.packet
- The packet to save.writeInformation
- Write the PacketProtocolInformation
to the stream.java.lang.NullPointerException
- A parameter is null.java.io.IOException
- A stream exception occurs.PacketException
- An Exception has occurred.public void writePacketNoDigest(java.io.OutputStream outputStream, + IPacket packet, + boolean writeInformation) + throws java.io.IOException, + PacketException+
IPacket
to an output stream.
+ NOTE: The getHashProvider()
for digests is NOT supported and no digest is expected for these packets.outputStream
- The output stream for writing.packet
- The packet to save.writeInformation
- Write the PacketProtocolInformation
to the stream.java.lang.NullPointerException
- A parameter is null.java.io.IOException
- A stream exception occurs.PacketException
- An Exception has occurred.public static int readInteger(java.io.InputStream inputStream) + throws java.io.IOException+
InputStream
.inputStream
- The input stream to use.java.lang.NullPointerException
- inputStream is null.java.io.IOException
- An I/O error has occurred.public static void writeInteger(java.io.OutputStream outputStream, + int i) + throws java.io.IOException+
OutputStream
using 4 bytes.outputStream
- The output stream to use.i
- The integer to store.java.lang.NullPointerException
- outputStream is null.java.lang.IllegalArgumentException
- i is less than 0.java.io.IOException
- An I/O error has occurred.public static byte readByteFromInputStream(java.io.InputStream inputStream) + throws java.io.IOException+
InputStream
.inputStream
- The input stream to read from.java.lang.NullPointerException
- inputStream is null.java.io.IOException
- An I/O error has occurred or end of stream has been reached.public static byte[] readArrayFromInputStream(java.io.InputStream inputStream, + int length) + throws java.io.IOException+
InputStream
.inputStream
- The input stream to read from.length
- The length of the stream.java.lang.NullPointerException
- inputStream is null.java.lang.IllegalArgumentException
- length is less than 0.java.io.IOException
- An I/O error occurs or end of stream has been reached.public static byte[] getByteArrayFromInteger(int i)+
i
- The integer to save.java.lang.IllegalArgumentException
- i is less than 0.public static int getIntegerFromByteArray(byte[] bytes)+
bytes
- The byte array.java.lang.NullPointerException
- bytes is null.java.lang.IllegalArgumentException
- bytes length is not 4.public int getPacketSize(IPacket packet, + boolean includeInformation, + boolean ignoreDigest) + throws PacketException+
packet
- The packet to check.includeInformation
- If the 2 byte information header is included.ignoreDigest
- If the digest length should be ignored if available.java.lang.NullPointerException
- packet is null.PacketException
- A Packet Exception has occurred.public class PacketProtocolInformation
+extends java.lang.Object
+IPacket
.Constructor and Description | +
---|
PacketProtocolInformation()
+Constructs a new instance of PacketProtocolInformation.
+ |
+
PacketProtocolInformation(byte major,
+ byte minor)
+Constructs a new instance of PacketProtocolInformation.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+equals(java.lang.Object o)
+Gets whether this object equals the passed object.
+ |
+
int |
+getMajor()
+Gets the major protocol for the packet.
+ |
+
int |
+getMinor()
+Gets the minor protocol for the packet.
+ |
+
static PacketProtocolInformation |
+getProtocolInformation(java.io.InputStream inputStream)
+Gets the
+PacketProtocolInformation of the packet. |
+
int |
+hashCode()
+Gets the hash code of the object.
+ |
+
static void |
+savePacketProtocolInformation(java.io.OutputStream outputStream,
+ PacketProtocolInformation information)
+Saves the
+PacketProtocolInformation of the packet. |
+
getClass, notify, notifyAll, toString, wait, wait, wait
public PacketProtocolInformation()+
public PacketProtocolInformation(byte major, + byte minor)+
major
- The major version.minor
- The minor version.public int getMajor()+
public int getMinor()+
public static PacketProtocolInformation getProtocolInformation(java.io.InputStream inputStream) + throws java.io.IOException+
PacketProtocolInformation
of the packet.inputStream
- The input stream for reading.java.lang.NullPointerException
- The inputStream is null.java.io.IOException
- A stream exception occurs.public static void savePacketProtocolInformation(java.io.OutputStream outputStream, + PacketProtocolInformation information) + throws java.io.IOException+
PacketProtocolInformation
of the packet.outputStream
- The output stream for writing.information
- The protocol information.java.lang.NullPointerException
- A parameter is null.java.io.IOException
- A stream exception occurs.public boolean equals(java.lang.Object o)+
equals
in class java.lang.Object
o
- The object to check.public int hashCode()+
hashCode
in class java.lang.Object
public class Base64Packet +extends java.lang.Object +implements IStreamedPacket+
IPacket
.
+ + Major ID: 255 + Minor ID: 251 +
Constructor and Description | +
---|
Base64Packet(IPacketFactory factory,
+ PacketLoader loader)
+Constructs a new Base64Packet with the specified
+IPacketFactory and PacketLoader . |
+
Base64Packet(IPacketFactory factory,
+ PacketLoader loader,
+ boolean useCache)
+Constructs a new Base64Packet with the specified
+IPacketFactory , PacketLoader
+ and if the encrypted data should be cached. |
+
Base64Packet(IPacketFactory factory,
+ PacketLoader loader,
+ IPacket packet)
+
+ |
+
Base64Packet(IPacketFactory factory,
+ PacketLoader loader,
+ IPacket packet,
+ boolean useCache)
+Constructs a new Base64Packet with the specified
+IPacketFactory , PacketLoader ,
+ IPacket and if the encrypted data should be cached. |
+
Modifier and Type | +Method and Description | +
---|---|
IPacketFactory |
+getFactory()
+Gets the
+IPacketFactory in use. |
+
IPacket |
+getHeldPacket()
+Gets the held packet or null.
+ |
+
PacketLoader |
+getPacketLoader()
+Gets the
+PacketLoader in use. |
+
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
int |
+getSize()
+Gets the size of the output data.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isCacheUsed()
+Gets if the encrypted data is cached.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
void |
+readData(java.io.OutputStream outputStream)
+Reads payload data to an
+OutputStream . |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
void |
+setCacheUsed(boolean used)
+Sets if the encrypted data is cached.
+ |
+
void |
+setFactory(IPacketFactory factory)
+Sets the
+IPacketFactory to use. |
+
void |
+setHeldPacket(IPacket packet)
+Sets the held packet.
+ |
+
void |
+setPacketLoader(PacketLoader loader)
+Sets the
+PacketLoader to use. |
+
void |
+writeData(java.io.InputStream inputStream,
+ int size)
+Writes payload data from an
+InputStream . |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public Base64Packet(IPacketFactory factory, + PacketLoader loader)+
IPacketFactory
and PacketLoader
.
+ The encrypted data will not be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.java.lang.NullPointerException
- factory or loader is null.public Base64Packet(IPacketFactory factory, + PacketLoader loader, + boolean useCache)+
IPacketFactory
, PacketLoader
+ and if the encrypted data should be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.useCache
- If the encrypted data should be cached.java.lang.NullPointerException
- factory or loader is null.public Base64Packet(IPacketFactory factory, + PacketLoader loader, + IPacket packet)+
IPacketFactory
, PacketLoader
and IPacket
.
+ The encrypted data will not be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.packet
- The packet to store or null.java.lang.NullPointerException
- factory or loader is null.public Base64Packet(IPacketFactory factory, + PacketLoader loader, + IPacket packet, + boolean useCache)+
IPacketFactory
, PacketLoader
,
+ IPacket
and if the encrypted data should be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.packet
- The packet to store or null.useCache
- If the encrypted data should be cached.java.lang.NullPointerException
- factory or loader is null.public boolean isValid()+
public PacketProtocolInformation getProtocol()+
getProtocol
in interface IPacket
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public void readData(java.io.OutputStream outputStream) + throws java.io.IOException, + PacketException+
OutputStream
.readData
in interface IStreamedPacket
outputStream
- The output stream to read data to.java.lang.NullPointerException
- outputStream is null.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.public void writeData(java.io.InputStream inputStream, + int size) + throws java.io.IOException, + PacketException+
InputStream
.writeData
in interface IStreamedPacket
inputStream
- The input stream to write data from.size
- The size of the input payload in bytes.java.lang.NullPointerException
- inputStream is null.java.lang.IllegalArgumentException
- size is less than 0.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.public int getSize() + throws PacketException+
getSize
in interface IStreamedPacket
PacketException
- An Exception has occurred.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 IPacketFactory getFactory()+
IPacketFactory
in use.public void setFactory(IPacketFactory factory)+
IPacketFactory
to use.factory
- The Packet Factory to use.java.lang.NullPointerException
- factory is null.public IPacket getHeldPacket()+
public void setHeldPacket(IPacket packet)+
packet
- The new packet or null.public boolean isCacheUsed()+
public void setCacheUsed(boolean used)+
used
- If the encrypted data should be cached.public class EncryptedPacket +extends java.lang.Object +implements IStreamedPacket, IInternalCache+
IPacket
.
+ + Major ID: 255 + Minor ID: 252 +
Constructor and Description | +
---|
EncryptedPacket(IPacketFactory factory,
+ PacketLoader loader,
+ com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)
+Constructs a new EncryptedPacket with the specified
+IPacketFactory , PacketLoader and ICipherFactory . |
+
EncryptedPacket(IPacketFactory factory,
+ PacketLoader loader,
+ com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory,
+ boolean useCache)
+Constructs a new EncryptedPacket with the specified
+IPacketFactory , PacketLoader , ICipherFactory
+ and if the encrypted data should be cached. |
+
EncryptedPacket(IPacketFactory factory,
+ PacketLoader loader,
+ com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory,
+ IPacket packet)
+Constructs a new EncryptedPacket with the specified
+IPacketFactory , PacketLoader , ICipherFactory and IPacket . |
+
EncryptedPacket(IPacketFactory factory,
+ PacketLoader loader,
+ com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory,
+ IPacket packet,
+ boolean useCache)
+Constructs a new EncryptedPacket with the specified
+IPacketFactory , PacketLoader , ICipherFactory ,
+ IPacket and if the encrypted data should be cached. |
+
Modifier and Type | +Method and Description | +
---|---|
com.captainalm.lib.stdcrypt.encryption.ICipherFactory |
+getCipherFactory()
+Gets the
+ICipherFactory being used. |
+
IPacketFactory |
+getFactory()
+Gets the
+IPacketFactory in use. |
+
IPacket |
+getHeldPacket()
+Gets the held packet or null.
+ |
+
PacketLoader |
+getPacketLoader()
+Gets the
+PacketLoader in use. |
+
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
int |
+getSize()
+Gets the size of the output data.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
java.lang.String |
+getTrailingPassword()
+Gets the trailing password (Or null if no trailing password).
+ |
+
boolean |
+isCacheUsed()
+Gets if the encrypted data is cached.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
void |
+readData(java.io.OutputStream outputStream)
+Reads payload data to an
+OutputStream . |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
void |
+setCacheUsed(boolean used)
+Sets if the encrypted data is cached.
+ |
+
void |
+setCipherFactory(com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)
+Sets the
+ICipherFactory being used. |
+
void |
+setFactory(IPacketFactory factory)
+Sets the
+IPacketFactory to use. |
+
void |
+setHeldPacket(IPacket packet)
+Sets the held packet.
+ |
+
void |
+setPacketLoader(PacketLoader loader)
+Sets the
+PacketLoader to use. |
+
void |
+setTrailingPassword(java.lang.String trailingPassword)
+Sets the trailing password (Use null for no trailing password).
+ |
+
void |
+writeData(java.io.InputStream inputStream,
+ int size)
+Writes payload data from an
+InputStream . |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public EncryptedPacket(IPacketFactory factory, + PacketLoader loader, + com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)+
IPacketFactory
, PacketLoader
and ICipherFactory
.
+ The encrypted data will not be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.cipherFactory
- The cipher factory to use.java.lang.NullPointerException
- factory, loader or cipherFactory is null.public EncryptedPacket(IPacketFactory factory, + PacketLoader loader, + com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory, + boolean useCache)+
IPacketFactory
, PacketLoader
, ICipherFactory
+ and if the encrypted data should be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.cipherFactory
- The cipher factory to use.useCache
- If the encrypted data should be cached.java.lang.NullPointerException
- factory, loader or cipherFactory is null.public EncryptedPacket(IPacketFactory factory, + PacketLoader loader, + com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory, + IPacket packet)+
IPacketFactory
, PacketLoader
, ICipherFactory
and IPacket
.
+ The encrypted data will not be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.cipherFactory
- The cipher factory to use.java.lang.NullPointerException
- factory, loader or cipherFactory is null.public EncryptedPacket(IPacketFactory factory, + PacketLoader loader, + com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory, + IPacket packet, + boolean useCache)+
IPacketFactory
, PacketLoader
, ICipherFactory
,
+ IPacket
and if the encrypted data should be cached.factory
- The packet factory to use.loader
- The Packet Loader to use.cipherFactory
- The cipher factory to use.useCache
- If the encrypted data should be cached.java.lang.NullPointerException
- factory, loader or cipherFactory is null.public boolean isValid()+
public PacketProtocolInformation getProtocol()+
getProtocol
in interface IPacket
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public void readData(java.io.OutputStream outputStream) + throws java.io.IOException, + PacketException+
OutputStream
.readData
in interface IStreamedPacket
outputStream
- The output stream to read data to.java.lang.NullPointerException
- outputStream is null.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.public void writeData(java.io.InputStream inputStream, + int size) + throws java.io.IOException, + PacketException+
InputStream
.writeData
in interface IStreamedPacket
inputStream
- The input stream to write data from.size
- The size of the input payload in bytes.java.lang.NullPointerException
- inputStream is null.java.lang.IllegalArgumentException
- size is less than 0.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.public int getSize() + throws PacketException+
getSize
in interface IStreamedPacket
PacketException
- An Exception has occurred.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 IPacketFactory getFactory()+
IPacketFactory
in use.public void setFactory(IPacketFactory factory)+
IPacketFactory
to use.factory
- The Packet Factory to use.java.lang.NullPointerException
- factory is null.public com.captainalm.lib.stdcrypt.encryption.ICipherFactory getCipherFactory()+
ICipherFactory
being used.public void setCipherFactory(com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)+
ICipherFactory
being used.cipherFactory
- The Cipher Factory.java.lang.NullPointerException
- cipherFactory is null.public java.lang.String getTrailingPassword()+
public void setTrailingPassword(java.lang.String trailingPassword)+
trailingPassword
- The new trailing password or null.public IPacket getHeldPacket()+
public void setHeldPacket(IPacket packet)+
packet
- The new packet or null.public boolean isCacheUsed()+
isCacheUsed
in interface IInternalCache
public void setCacheUsed(boolean used)+
setCacheUsed
in interface IInternalCache
used
- If the encrypted data should be cached.public class NetworkEncryptionCipherPacket +extends java.lang.Object +implements IStreamedPacket, IAcknowledgement, IInternalCache+
+ Major ID: 255 + Minor ID: 250 +
Constructor and Description | +
---|
NetworkEncryptionCipherPacket(java.lang.Boolean acknowledgement,
+ java.lang.String[] cipherNames)
+Constructs a new instance of NetworkEncryptionCipherPacket with the specified acknowledgement value and the specified ciphers.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String[] |
+getCiphers()
+Gets the cipher names this packet contains.
+ |
+
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
int |
+getSize()
+Gets the size of the output data.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isAcknowledgement()
+Gets if the class instance is an Acknowledgement.
+ |
+
boolean |
+isCacheUsed()
+Gets if the cipher information is cached.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
void |
+readData(java.io.OutputStream outputStream)
+Reads payload data to an
+OutputStream . |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
void |
+setCacheUsed(boolean used)
+Sets if the cipher information is cached.
+ |
+
void |
+setCiphers(java.lang.String[] cipherNames)
+Sets the cipher names this packet contains.
+ |
+
void |
+writeData(java.io.InputStream inputStream,
+ int size)
+Writes payload data from an
+InputStream . |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetworkEncryptionCipherPacket(java.lang.Boolean acknowledgement, + java.lang.String[] cipherNames)+
acknowledgement
- The acknowledgement value to use (Can be null).cipherNames
- The cipher names.java.lang.NullPointerException
- cipherNames is null.public boolean isAcknowledgement()+
isAcknowledgement
in interface IAcknowledgement
public boolean isValid()+
public PacketProtocolInformation getProtocol()+
getProtocol
in interface IPacket
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public void readData(java.io.OutputStream outputStream) + throws java.io.IOException, + PacketException+
OutputStream
.readData
in interface IStreamedPacket
outputStream
- The output stream to read data to.java.lang.NullPointerException
- outputStream is null.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.public void writeData(java.io.InputStream inputStream, + int size) + throws java.io.IOException, + PacketException+
InputStream
.writeData
in interface IStreamedPacket
inputStream
- The input stream to write data from.size
- The size of the input payload in bytes.java.lang.NullPointerException
- inputStream is null.java.lang.IllegalArgumentException
- size is less than 0.java.io.IOException
- An IO Exception has occurred.PacketException
- An Exception has occurred.public int getSize() + throws PacketException+
getSize
in interface IStreamedPacket
PacketException
- An Exception has occurred.public java.lang.String[] getCiphers()+
public void setCiphers(java.lang.String[] cipherNames)+
cipherNames
- The array of cipher names.java.lang.NullPointerException
- cipherNames is null.public boolean isCacheUsed()+
isCacheUsed
in interface IInternalCache
public void setCacheUsed(boolean used)+
setCacheUsed
in interface IInternalCache
used
- If the cipher information is cached.public class NetworkEncryptionUpgradePacket +extends java.lang.Object +implements IPacket, IAcknowledgement+
Base64Packet
s or EncryptedPacket
s.
+ + Major ID: 255 + Minor ID: 253 +
Constructor and Description | +
---|
NetworkEncryptionUpgradePacket(java.lang.Boolean acknowledgement,
+ boolean upgrade,
+ boolean base64ed,
+ com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)
+Constructs a new NetworkEncryptionUpgradePacket with the specified acknowledgement value, upgrade value, base 64 value and
+ICipherFactory . |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+areSecretsSent()
+Gets if secrets are sent as part of cipher settings.
+ |
+
com.captainalm.lib.stdcrypt.encryption.ICipherFactory |
+getCipherFactory()
+Gets the
+ICipherFactory being used or null. |
+
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isAcknowledgement()
+Gets if the class instance is an Acknowledgement.
+ |
+
boolean |
+isBase64ed()
+Gets if base 64 is used.
+ |
+
boolean |
+isUpgrade()
+Gets if the packet is treated as a stream upgrade or
+ a change in packet use for
+EncryptedPacket and Base64Packet . |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
void |
+setBase64ed(boolean base64ed)
+Sets if base64 is used.
+ |
+
void |
+setCipherFactory(com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)
+Sets the
+ICipherFactory being used. |
+
void |
+setIfSecretsSent(boolean sendSecrets)
+Sets if secrets should be sent as part of cipher settings.
+ |
+
void |
+setUpgrade(boolean upgrade)
+Sets if the packet is treated as a stream upgrade or
+ a change in packet use for
+EncryptedPacket and Base64Packet . |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetworkEncryptionUpgradePacket(java.lang.Boolean acknowledgement, + boolean upgrade, + boolean base64ed, + com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)+
ICipherFactory
.acknowledgement
- The acknowledgement value to use (Can be null).upgrade
- Is the packet treated as a stream upgrade, See: isUpgrade()
.base64ed
- Is the packet signalling base 64 to be used.cipherFactory
- The cipherFactory to signal for use.public boolean isValid()+
public PacketProtocolInformation getProtocol()+
getProtocol
in interface IPacket
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public boolean isUpgrade()+
EncryptedPacket
and Base64Packet
.public void setUpgrade(boolean upgrade)+
EncryptedPacket
and Base64Packet
.upgrade
- If the packet is a stream upgrade.public boolean isBase64ed()+
public void setBase64ed(boolean base64ed)+
base64ed
- If base 64 is to be used.public com.captainalm.lib.stdcrypt.encryption.ICipherFactory getCipherFactory()+
ICipherFactory
being used or null.public void setCipherFactory(com.captainalm.lib.stdcrypt.encryption.ICipherFactory cipherFactory)+
ICipherFactory
being used.cipherFactory
- The Cipher Factory or null.public boolean isAcknowledgement()+
isAcknowledgement
in interface IAcknowledgement
public boolean areSecretsSent()+
public void setIfSecretsSent(boolean sendSecrets)+
sendSecrets
- If secrets are part of the cipher settings.public class NetworkIdentifierPacket +extends java.lang.Object +implements IPacket+
+ Major ID: 255 + Minor ID: 255 +
Constructor and Description | +
---|
NetworkIdentifierPacket(java.lang.String id)
+Constructs a new instance of NetworkIdentifierPacket with the specified ID.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetworkIdentifierPacket(java.lang.String id)+
id
- The network ID of the client.public boolean isValid()+
public PacketProtocolInformation getProtocol()+
getProtocol
in interface IPacket
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public class NetworkSSLUpgradePacket +extends java.lang.Object +implements IPacket, IAcknowledgement+
+ Major ID: 255 + Minor ID: 254 +
Constructor and Description | +
---|
NetworkSSLUpgradePacket(java.lang.Boolean acknowledgement)
+Constructs a new NetworkSSLUpgrade packet with the specified acknowledgement value.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isAcknowledgement()
+Gets if the class instance is an Acknowledgement.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetworkSSLUpgradePacket(java.lang.Boolean acknowledgement)+
acknowledgement
- The acknowledgement value to use (Can be null).public boolean isValid()+
public PacketProtocolInformation getProtocol()+
getProtocol
in interface IPacket
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public boolean isAcknowledgement()+
isAcknowledgement
in interface IAcknowledgement
See: Description
+Class | +Description | +
---|---|
Base64Packet | +
+ This class provides a base64 encrypted packet that can hold an
+IPacket . |
+
EncryptedPacket | +
+ This class provides an encrypted packet that can hold an
+IPacket . |
+
NetworkEncryptionCipherPacket | +
+ This class provides the ability for supporting streams to negotiate a cipher.
+ |
+
NetworkEncryptionUpgradePacket | +
+ This class provides the ability for supporting streams to upgrade to using password encrypted and / or base64 connections.
+ |
+
NetworkIdentifierPacket | +
+ This class provides a packet that is used to identify the type of network client is using this library.
+ |
+
NetworkSSLUpgradePacket | +
+ This class provides the ability for supporting streams to upgrade to using SSL connections.
+ |
+
+ Major ID: 255 +
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. |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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.public class CALMNETPacketFactoryWithPacket +extends CALMNETPacketFactory+
IPacketFactory
for calmnet packets
+ with the ability to set the IPacket
of supporting packets.Constructor and Description | +
---|
CALMNETPacketFactoryWithPacket(boolean preferStreamPackets,
+ PacketLoader loader)
+Constructs a new Instance of CALMNETPacketFactoryWithPacket with if
+IStreamedPacket s are preferred and the specified PacketLoader . |
+
CALMNETPacketFactoryWithPacket(boolean preferStreamPackets,
+ PacketLoader loader,
+ IPacketFactory factory)
+Constructs a new Instance of CALMNETPacketFactoryWithPacket with if
+IStreamedPacket s are preferred, the specified PacketLoader and the IPacketFactory . |
+
Modifier and Type | +Method and Description | +
---|---|
IPacket |
+getPacket()
+Gets the
+IPacket in use (Could be the same instance). |
+
IPacket |
+getPacket(PacketProtocolInformation information)
+Constructs a
+IPacket of the protocol specified by the passed PacketProtocolInformation instance. |
+
void |
+setPacket(IPacket packet)
+Sets the
+IPacket in use. |
+
areStreamPacketsPreferred, getCipherFactory, getPacketFactory, getPacketLoader, setCipherFactory, setPacketFactory, setPacketLoader, setStreamPacketsPreferred
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public CALMNETPacketFactoryWithPacket(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 CALMNETPacketFactoryWithPacket(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
getPacket
in class CALMNETPacketFactory
information
- The protocol information to use.java.lang.NullPointerException
- The information is null.public IPacket getPacket()+
IPacket
in use (Could be the same instance).public interface IPacketFactory
+IPacket
s given their PacketProtocolInformation
.Modifier and Type | +Method and Description | +
---|---|
boolean |
+areStreamPacketsPreferred()
+Gets if
+getPacket(PacketProtocolInformation) prefers returning IStreamedPacket s if possible. |
+
IPacket |
+getPacket(PacketProtocolInformation information)
+Constructs a
+IPacket of the protocol specified by the passed PacketProtocolInformation instance. |
+
void |
+setStreamPacketsPreferred(boolean preferred)
+Sets if
+getPacket(PacketProtocolInformation) prefers returning IStreamedPacket s if possible. |
+
IPacket getPacket(PacketProtocolInformation information)+
IPacket
of the protocol specified by the passed PacketProtocolInformation
instance.information
- The protocol information to use.java.lang.NullPointerException
- The information is null.boolean areStreamPacketsPreferred()+
getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.void setStreamPacketsPreferred(boolean preferred)+
getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.preferred
- If streamed packets are preferred for construction.IPacketFactory
interface and standard classes.See: Description
+Interface | +Description | +
---|---|
IPacketFactory | +
+ This interface provides the ability to construct
+IPacket s given their PacketProtocolInformation . |
+
Class | +Description | +
---|---|
CALMNETPacketFactory | +
+ This class provides a standard extensible
+IPacketFactory for calmnet packets. |
+
CALMNETPacketFactoryWithPacket | +
+ This class provides a standard extensible
+IPacketFactory for calmnet packets
+ with the ability to set the IPacket of supporting packets. |
+
IPacketFactory
interface and standard classes.public class FragmentAllocatePacket +extends java.lang.Object +implements IPacket+
FragmentAllocationPacket
.
+ + Major ID: 254 + Minor ID: 1 +
Constructor and Description | +
---|
FragmentAllocatePacket(java.lang.Integer fragmentCount,
+ java.util.UUID allocationID)
+Constructs a new FragmentAllocatePacket given the fragment count and allocation UUID.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.UUID |
+getAllocationID()
+Gets the allocation ID or null.
+ |
+
java.lang.Integer |
+getFragmentCount()
+Gets the number of fragments or null.
+ |
+
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentAllocatePacket(java.lang.Integer fragmentCount, + java.util.UUID allocationID)+
fragmentCount
- The number of fragments to allocate.allocationID
- The allocation ID.java.lang.IllegalArgumentException
- fragmentCount is less than 1.public boolean isValid()+
public PacketProtocolInformation getProtocol()+
getProtocol
in interface IPacket
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public java.lang.Integer getFragmentCount()+
public java.util.UUID getAllocationID()+
public class FragmentAllocationPacket +extends FragmentPIDPacket+
FragmentAllocatePacket
.
+ + Major ID: 254 + Minor ID: 2 +
Constructor and Description | +
---|
FragmentAllocationPacket(java.lang.Integer packetID,
+ java.util.UUID allocationID,
+ java.lang.Boolean success)
+Constructs a new FragmentAllocationPacket given the packet ID, allocation ID and if it's successful.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+allocationSuccessful()
+Checks if the allocation is successful.
+ |
+
java.util.UUID |
+getAllocationID()
+Gets the allocation ID or null.
+ |
+
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
getPacketID
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentAllocationPacket(java.lang.Integer packetID, + java.util.UUID allocationID, + java.lang.Boolean success)+
packetID
- The packet ID.allocationID
- The allocation ID.success
- The allocation was successful.java.lang.IllegalArgumentException
- packetID is less than 0.public boolean isValid()+
isValid
in interface IPacket
isValid
in class FragmentPIDPacket
public PacketProtocolInformation getProtocol()+
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public boolean allocationSuccessful()+
public java.util.UUID getAllocationID()+
public class FragmentMessagePacket +extends FragmentPIDMSGPacket+
FragmentMessageResponsePacket
.
+ + Major ID: 254 + Minor ID: 3 +
Constructor and Description | +
---|
FragmentMessagePacket(java.lang.Integer packetID,
+ java.lang.Integer fragmentID,
+ byte[] payload)
+Constructs a new FragmentMessagePacket given the packet ID, fragment ID and payload.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
getFragmentID, getFragmentMessage, loadPayload
getPacketID
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentMessagePacket(java.lang.Integer packetID, + java.lang.Integer fragmentID, + byte[] payload)+
packetID
- The packet ID.fragmentID
- The fragment ID.payload
- The payload to store.java.lang.IllegalArgumentException
- packetID or fragmentID is less than 0.public boolean isValid()+
isValid
in interface IPacket
isValid
in class FragmentPIDMSGPacket
public PacketProtocolInformation getProtocol()+
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
savePayload
in class FragmentPIDMSGPacket
PacketException
- An Exception has occurred.public class FragmentMessageResponsePacket +extends FragmentPIDMSGPacket+
FragmentMessagePacket
.
+ + Major ID: 254 + Minor ID: 4 +
Constructor and Description | +
---|
FragmentMessageResponsePacket(java.lang.Integer packetID,
+ java.lang.Integer fragmentID,
+ byte[] payload)
+Constructs a new FragmentMessageResponsePacket given the packet ID, fragment ID and payload.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
getFragmentID, getFragmentMessage, isValid, loadPayload, savePayload
getPacketID
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentMessageResponsePacket(java.lang.Integer packetID, + java.lang.Integer fragmentID, + byte[] payload)+
packetID
- The packet ID.fragmentID
- The fragment ID.payload
- The payload to store.java.lang.IllegalArgumentException
- packetID or fragmentID is less than 0.public PacketProtocolInformation getProtocol()+
public static PacketProtocolInformation getTheProtocol()+
public abstract class FragmentPIDAKNPacket +extends FragmentPIDPacket +implements IAcknowledgement+
Constructor and Description | +
---|
FragmentPIDAKNPacket(java.lang.Integer packetID,
+ java.lang.Boolean acknowledgement)
+Constructs a new FragmentPIDPacket given the packet ID and the acknowledgement value.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+isAcknowledgement()
+Gets if the class instance is an Acknowledgement.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
getPacketID
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProtocol
public FragmentPIDAKNPacket(java.lang.Integer packetID, + java.lang.Boolean acknowledgement)+
packetID
- The packet ID.acknowledgement
- The acknowledgement value to use.java.lang.IllegalArgumentException
- packetID is less than 0.public boolean isValid()+
isValid
in interface IPacket
isValid
in class FragmentPIDPacket
public byte[] savePayload() + throws PacketException+
savePayload
in interface IPacket
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
loadPayload
in interface IPacket
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public boolean isAcknowledgement()+
isAcknowledgement
in interface IAcknowledgement
public abstract class FragmentPIDMSGPacket +extends FragmentPIDPacket+
Constructor and Description | +
---|
FragmentPIDMSGPacket(java.lang.Integer packetID,
+ java.lang.Integer fragmentID,
+ byte[] payload)
+Constructs a new FragmentPIDMSGPacket given the packet ID, fragment ID and payload.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.Integer |
+getFragmentID()
+Gets the fragment ID or null.
+ |
+
byte[] |
+getFragmentMessage()
+Gets the fragment message byte array or null.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
getPacketID
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProtocol
public FragmentPIDMSGPacket(java.lang.Integer packetID, + java.lang.Integer fragmentID, + byte[] payload)+
packetID
- The packet ID.fragmentID
- The fragment ID.payload
- The payload to store.java.lang.IllegalArgumentException
- packetID or fragmentID is less than 0.public boolean isValid()+
isValid
in interface IPacket
isValid
in class FragmentPIDPacket
public byte[] savePayload() + throws PacketException+
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public byte[] getFragmentMessage()+
public java.lang.Integer getFragmentID()+
public abstract class FragmentPIDPacket +extends java.lang.Object +implements IPacket+
Constructor and Description | +
---|
FragmentPIDPacket(java.lang.Integer packetID)
+Constructs a new FragmentPIDPacket given the packet ID.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.Integer |
+getPacketID()
+Gets the packet ID or null.
+ |
+
boolean |
+isValid()
+Gets if the packet is valid.
+ |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProtocol, loadPayload, savePayload
public FragmentPIDPacket(java.lang.Integer packetID)+
packetID
- The packet ID.java.lang.IllegalArgumentException
- packetID is less than 0.public final class FragmentReceiver
+extends java.lang.Object
+com.captainalm.lib.calmnet.packet.fragment
.Constructor and Description | +
---|
FragmentReceiver(PacketLoader loader,
+ IPacketFactory factory)
+Constructs a new FragmentReceiver with the specified
+PacketLoader and IPacketFactory . |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+areFinishedIDsWaiting()
+Gets whether finished IDs are waiting for obtaining.
+ |
+
boolean |
+arePacketsWaiting()
+Gets whether packets are waiting to be received.
+ |
+
void |
+clearLastIDFinished()
+Clears all the last finished packet IDs.
+ |
+
void |
+clearRegistry()
+Clears the registry (And requests the sender to stop sending).
+ |
+
void |
+clearWaitingPackets()
+Clears the currently waiting packets.
+ |
+
void |
+deletePacketFromRegistry(int id)
+Deletes a packet from the registry and requests the sender to stop sending.
+ |
+
int |
+getLastIDFinished()
+Gets the last finished packet ID.
+ |
+
int |
+getNumberOfEmptySendsTillForcedCompleteOrResend()
+Gets the number of
+sendPacket() calls, that return null, to a registry entry are made before
+ the FragmentSendCompletePacket or FragmentRetrySendPacket packets are sent. |
+
IPacketFactory |
+getPacketFactory()
+Gets the
+IPacketFactory in use. |
+
PacketLoader |
+getPacketLoader()
+Gets the
+PacketLoader in use. |
+
java.lang.Integer |
+pollLastIDFinished()
+Polls the last finished packet ID.
+ |
+
IPacket |
+receivePacket()
+Receives a
+IPacket from the FragmentReceiver. |
+
boolean |
+receivePacket(IPacket packetIn)
+Receives a
+IPacket into the FragmentReceiver. |
+
IPacket |
+receivePacketPolling()
+Receives a
+IPacket from the FragmentReceiver. |
+
IPacket[] |
+sendPacket()
+Sends the current
+IPacket s from the FragmentReceiver. |
+
void |
+setNumberOfEmptySendsTillForcedCompleteOrResend(int numberOfEmptySends)
+Sets the number of
+sendPacket() calls, that return null, to a registry entry are made before
+ the FragmentSendCompletePacket or FragmentRetrySendPacket packets are sent. |
+
void |
+setPacketFactory(IPacketFactory factory)
+Sets the
+IPacketFactory to use. |
+
void |
+setPacketLoader(PacketLoader loader)
+Sets the
+PacketLoader to use. |
+
void |
+setResponseVerification(boolean state)
+Sets whether responses should be verified.
+ |
+
void |
+setSentDataWillBeAllVerified(boolean state)
+Gets whether all sent fragments are verified to be equal.
+ |
+
boolean |
+shouldSentDataBeAllVerified()
+Gets whether all sent fragments are verified to be equal.
+ |
+
boolean |
+shouldVerifyResponses()
+Gets whether responses should be verified.
+ |
+
void |
+stopAllDataVerificationAndCompleteReceive()
+Stops data verification for all packets being received when
+shouldSentDataBeAllVerified() is true. |
+
void |
+stopDataVerificationAndCompleteReceive(int id)
+Stops data verification for the specified Packet ID when
+shouldSentDataBeAllVerified() is true. |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentReceiver(PacketLoader loader, + IPacketFactory factory)+
PacketLoader
and IPacketFactory
.loader
- The packet loader to use.factory
- The packet factory to use.java.lang.NullPointerException
- loader or factory is null.public IPacket receivePacket() + throws java.lang.InterruptedException+
IPacket
from the FragmentReceiver.
+ This method blocks until a packet can be received.java.lang.InterruptedException
- The Thread was Interrupted.public IPacket receivePacketPolling()+
IPacket
from the FragmentReceiver.public IPacket[] sendPacket() + throws PacketException+
IPacket
s from the FragmentReceiver.PacketException
- A Packet Exception has occurred.public boolean receivePacket(IPacket packetIn) + throws PacketException+
IPacket
into the FragmentReceiver.packetIn
- The packet to receive.PacketException
- A Packet Exception has occurred.public boolean arePacketsWaiting()+
public void clearWaitingPackets()+
public void deletePacketFromRegistry(int id)+
id
- The ID of the packet to remove.public void clearRegistry()+
public boolean areFinishedIDsWaiting()+
public int getLastIDFinished() + throws java.lang.InterruptedException+
java.lang.InterruptedException
- The Thread was Interrupted.public java.lang.Integer pollLastIDFinished()+
public void clearLastIDFinished()+
public IPacketFactory getPacketFactory()+
IPacketFactory
in use.public void setPacketFactory(IPacketFactory factory)+
IPacketFactory
to use.factory
- The packet factory to use.java.lang.NullPointerException
- factory is 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 boolean shouldVerifyResponses()+
public void setResponseVerification(boolean state)+
setSentDataWillBeAllVerified(boolean)
will be set to false too.state
- If responses should be verified.public boolean shouldSentDataBeAllVerified()+
public void setSentDataWillBeAllVerified(boolean state)+
setResponseVerification(boolean)
set to true.state
- If all sent fragments will be verified to be equal.public int getNumberOfEmptySendsTillForcedCompleteOrResend()+
sendPacket()
calls, that return null, to a registry entry are made before
+ the FragmentSendCompletePacket
or FragmentRetrySendPacket
packets are sent.
+ A FragmentSendCompletePacket
is sent if completely received and a
+ FragmentRetrySendPacket
is sent if not completely received.
+ This excludes empty packets due to shouldSentDataBeAllVerified()
.public void setNumberOfEmptySendsTillForcedCompleteOrResend(int numberOfEmptySends)+
sendPacket()
calls, that return null, to a registry entry are made before
+ the FragmentSendCompletePacket
or FragmentRetrySendPacket
packets are sent.
+ A FragmentSendCompletePacket
is sent if completely received and a
+ FragmentRetrySendPacket
is sent if not completely received.
+ This excludes empty packets due to shouldSentDataBeAllVerified()
.numberOfEmptySends
- The number of empty sends to allow.java.lang.IllegalArgumentException
- numberOfEmptySends is less than 1.public void stopDataVerificationAndCompleteReceive(int id)+
shouldSentDataBeAllVerified()
is true.id
- The PacketID to act on.public void stopAllDataVerificationAndCompleteReceive()+
shouldSentDataBeAllVerified()
is true.public class FragmentRetrySendPacket +extends FragmentPIDAKNPacket+
+ Major ID: 254 + Minor ID: 6 +
Constructor and Description | +
---|
FragmentRetrySendPacket(java.lang.Integer packetID,
+ java.lang.Boolean acknowledgement)
+Constructs a new FragmentRetrySendPacket given the packet ID and the acknowledgement value.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
isAcknowledgement, isValid, loadPayload, savePayload
getPacketID
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentRetrySendPacket(java.lang.Integer packetID, + java.lang.Boolean acknowledgement)+
packetID
- The packet ID.acknowledgement
- The acknowledgement value to use.java.lang.IllegalArgumentException
- packetID is less than 0.public PacketProtocolInformation getProtocol()+
public static PacketProtocolInformation getTheProtocol()+
public class FragmentSendCompletePacket +extends FragmentPIDAKNPacket+
+ Major ID: 254 + Minor ID: 5 +
Constructor and Description | +
---|
FragmentSendCompletePacket(java.lang.Integer packetID,
+ java.lang.Boolean acknowledgement)
+Constructs a new FragmentSendCompletePacket given the packet ID and the acknowledgement value.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
isAcknowledgement, isValid, loadPayload, savePayload
getPacketID
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentSendCompletePacket(java.lang.Integer packetID, + java.lang.Boolean acknowledgement)+
packetID
- The packet ID.acknowledgement
- The acknowledgement value to use.java.lang.IllegalArgumentException
- packetID is less than 0.public PacketProtocolInformation getProtocol()+
public static PacketProtocolInformation getTheProtocol()+
public class FragmentSendStopPacket +extends FragmentPIDPacket+
FragmentSender
.
+ + Major ID: 254 + Minor ID: 7 +
Constructor and Description | +
---|
FragmentSendStopPacket(java.lang.Integer packetID)
+Constructs a new FragmentSendStopPacket given the packet ID.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
getPacketID, isValid
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentSendStopPacket(java.lang.Integer packetID)+
packetID
- The packet ID.java.lang.IllegalArgumentException
- packetID is less than 0.public PacketProtocolInformation getProtocol()+
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public class FragmentSendVerifyCompletePacket +extends FragmentPIDPacket+
+ Major ID: 254 + Minor ID: 8 +
Constructor and Description | +
---|
FragmentSendVerifyCompletePacket(java.lang.Integer packetID)
+Constructs a new FragmentSendVerifyCompletePacket given the packet ID.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PacketProtocolInformation |
+getProtocol()
+Gets the protocol information.
+ |
+
static PacketProtocolInformation |
+getTheProtocol()
+Gets the protocol information statically.
+ |
+
void |
+loadPayload(byte[] packetData)
+Loads the packet payload from save data.
+ |
+
byte[] |
+savePayload()
+Saves the packet payload to a byte array.
+ |
+
getPacketID, isValid
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentSendVerifyCompletePacket(java.lang.Integer packetID)+
packetID
- The packet ID.java.lang.IllegalArgumentException
- packetID is less than 0.public PacketProtocolInformation getProtocol()+
public static PacketProtocolInformation getTheProtocol()+
public byte[] savePayload() + throws PacketException+
PacketException
- An Exception has occurred.public void loadPayload(byte[] packetData) + throws PacketException+
packetData
- The packet payload data.java.lang.NullPointerException
- The new store data is null.PacketException
- An Exception has occurred.public final class FragmentSender
+extends java.lang.Object
+com.captainalm.lib.calmnet.packet.fragment
.Constructor and Description | +
---|
FragmentSender(PacketLoader loader)
+Constructs a new FragmentSender with the specified
+PacketLoader . |
+
FragmentSender(PacketLoader loader,
+ int newSize)
+Constructs a new FragmentSender with the specified
+PacketLoader
+ and packet split size in bytes. |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+areFinishedIDsWaiting()
+Gets whether finished IDs are waiting for obtaining.
+ |
+
boolean |
+arePacketsWaiting()
+Gets whether packets are waiting for allocation.
+ |
+
void |
+clearLastIDFinished()
+Clears all the last finished packet IDs.
+ |
+
void |
+clearRegistry()
+Clears the registry.
+ |
+
void |
+clearWaitingPackets()
+Clears the currently waiting packets.
+ |
+
void |
+deletePacketFromRegistry(int id)
+Deletes a packet from the registry.
+ |
+
int |
+getLastIDFinished()
+Gets the last finished packet ID.
+ |
+
PacketLoader |
+getPacketLoader()
+Gets the
+PacketLoader in use. |
+
int |
+getSplitSize()
+Gets the current packet split size in bytes.
+ |
+
java.lang.Integer |
+pollLastIDFinished()
+Polls the last finished packet ID.
+ |
+
boolean |
+receivePacket(IPacket packetIn)
+Receives a
+IPacket into the FragmentSender. |
+
IPacket[] |
+sendPacket()
+Sends the current
+IPacket s from the FragmentSender. |
+
void |
+sendPacket(IPacket packetIn)
+Sends a
+IPacket using this FragmentSender. |
+
void |
+setPacketLoader(PacketLoader loader)
+Sets the
+PacketLoader to use. |
+
void |
+setResponseVerification(boolean state)
+Sets whether responses should be verified.
+ |
+
void |
+setSentDataWillBeAllVerified(boolean state)
+Gets whether all sent fragments are verified to be equal.
+ |
+
void |
+setSplitSize(int newSize)
+Sets the packet split size in bytes.
+ |
+
boolean |
+shouldSentDataBeAllVerified()
+Gets whether all sent fragments are verified to be equal.
+ |
+
boolean |
+shouldVerifyResponses()
+Gets whether responses should be verified.
+ |
+
void |
+stopAllDataVerificationAndCompleteSend()
+Stops data verification for all packets being sent when
+shouldSentDataBeAllVerified() is true. |
+
void |
+stopDataVerificationAndCompleteSend(int id)
+Stops data verification for the specified Packet ID when
+shouldSentDataBeAllVerified() is true. |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FragmentSender(PacketLoader loader)+
PacketLoader
.loader
- The packet loader to use.java.lang.NullPointerException
- loader is null.public FragmentSender(PacketLoader loader, + int newSize)+
PacketLoader
+ and packet split size in bytes.loader
- The packet loader to use.newSize
- The new split size.java.lang.NullPointerException
- loader is null.java.lang.IllegalArgumentException
- newSize is less than 1.public void sendPacket(IPacket packetIn)+
IPacket
using this FragmentSender.packetIn
- The packet to fragment and send.public IPacket[] sendPacket() + throws PacketException+
IPacket
s from the FragmentSender.PacketException
- A Packet Exception has occurred.public boolean receivePacket(IPacket packetIn) + throws PacketException+
IPacket
into the FragmentSender.packetIn
- The packet to receive.PacketException
- A Packet Exception has occurred.public boolean arePacketsWaiting()+
public void clearWaitingPackets()+
public void deletePacketFromRegistry(int id)+
id
- The ID of the packet to remove.public void clearRegistry()+
public boolean areFinishedIDsWaiting()+
public int getLastIDFinished() + throws java.lang.InterruptedException+
java.lang.InterruptedException
- The Thread was Interrupted.public java.lang.Integer pollLastIDFinished()+
public void clearLastIDFinished()+
public int getSplitSize()+
public void setSplitSize(int newSize)+
newSize
- The new packet split size.java.lang.IllegalArgumentException
- newSize is less than 1.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 boolean shouldVerifyResponses()+
public void setResponseVerification(boolean state)+
setSentDataWillBeAllVerified(boolean)
will be set to false too.state
- If responses should be verified.public boolean shouldSentDataBeAllVerified()+
public void setSentDataWillBeAllVerified(boolean state)+
setResponseVerification(boolean)
set to true.state
- If all sent fragments will be verified to be equal.public void stopDataVerificationAndCompleteSend(int id)+
shouldSentDataBeAllVerified()
is true.id
- The PacketID to act on.public void stopAllDataVerificationAndCompleteSend()+
shouldSentDataBeAllVerified()
is true.FragmentReceiver
and FragmentSender
objects.See: Description
+Class | +Description | +
---|---|
FragmentAllocatePacket | +
+ This class provides a packet for fragment allocation requesting.
+ |
+
FragmentAllocationPacket | +
+ This class provides a packet for giving the allocated packetID
+ as a response for
+FragmentAllocatePacket . |
+
FragmentMessagePacket | +
+ This class provides a packet for sending a payload with a packetID and fragmentID.
+ |
+
FragmentMessageResponsePacket | +
+ This class provides a packet for sending an optional payload with a packetID and fragmentID
+ as a response for
+FragmentMessagePacket . |
+
FragmentPIDAKNPacket | +
+ This abstract base class provides the ability for packets to contain an ID and if it is an Acknowledgement.
+ |
+
FragmentPIDMSGPacket | +
+ This abstract base class provides the ability for packets to contain an ID, a Fragment ID and a payload.
+ |
+
FragmentPIDPacket | +
+ This abstract base class provides the ability for packets to return an ID.
+ |
+
FragmentReceiver | +
+ This class provides the ability to re-construct packets from
+com.captainalm.lib.calmnet.packet.fragment . |
+
FragmentRetrySendPacket | +
+ This class provides a packet for signalling that the sending end
+ should start re-sending un acknowledged fragment packets.
+ |
+
FragmentSendCompletePacket | +
+ This class provides a packet for signalling that all fragments for a packet have been sent or that sending has been successfully cancelled.
+ |
+
FragmentSender | +
+ This class provides the ability to create packets for
+com.captainalm.lib.calmnet.packet.fragment . |
+
FragmentSendStopPacket | +
+ This class provides a packet for stopping the remote
+FragmentSender . |
+
FragmentSendVerifyCompletePacket | +
+ This class provides a packet for stating that all packets have been successfully sent and verified.
+ |
+
FragmentReceiver
and FragmentSender
objects.
+ + Major ID: 254 +
See: Description
+Interface | +Description | +
---|---|
IAcknowledgement | +
+ This interface allows obtaining if the class instance is an Acknowledgement.
+ |
+
IInternalCache | +
+ This interface allows getting and setting if the
+ internal cache should be used within a class instance.
+ |
+
IPacket | +
+ This interface provides the packet methods.
+ |
+
IStreamedPacket | +
+ This interface provides the streaming packet methods.
+ |
+
Class | +Description | +
---|---|
PacketLoader | ++ + | +
PacketProtocolInformation | +
+ This class provides the packet protocol information for
+IPacket . |
+
Exception | +Description | +
---|---|
PacketException | +
+ This class provides the packet exception wrapper class.
+ |
+
public class SSLUtilities
+extends java.lang.Object
+SSLContext
and SSLSocket
+ objects using JKS files (Or other supported formats).Constructor and Description | +
---|
SSLUtilities() |
+
Modifier and Type | +Method and Description | +
---|---|
static javax.net.ssl.SSLSocket |
+getSSLClientSocket(javax.net.ssl.SSLContext sslContext,
+ java.lang.String host,
+ int port)
+Creates a new
+SSLSocket using the specified SSLContext , host and port. |
+
static javax.net.ssl.SSLContext |
+getSSLContext(java.lang.String algorithmName,
+ java.security.KeyStore unifiedKeyStore,
+ char[] keyStorePassword)
+Gets the SSL context merged with the JRE Trust Store using a unified
+KeyStore . |
+
static javax.net.ssl.SSLContext |
+getSSLContext(java.lang.String algorithmName,
+ java.security.KeyStore privateKeyStore,
+ char[] privateKeyStorePassword,
+ java.security.KeyStore trustKeyStore)
+Gets the SSL context merged with the JRE Trust Store using separate private and trust
+KeyStore s. |
+
static javax.net.ssl.SSLContext |
+getSSLContextNoJRETrust(java.lang.String algorithmName,
+ java.security.KeyStore unifiedKeyStore,
+ char[] keyStorePassword)
+Gets the SSL context without the JRE Trust Store using a unified
+KeyStore . |
+
static javax.net.ssl.SSLContext |
+getSSLContextNoJRETrust(java.lang.String algorithmName,
+ java.security.KeyStore privateKeyStore,
+ char[] privateKeyStorePassword,
+ java.security.KeyStore trustKeyStore)
+Gets the SSL context without the JRE Trust Store using separate private and trust
+KeyStore s. |
+
static javax.net.ssl.SSLServerSocket |
+getSSLServerSocket(javax.net.ssl.SSLContext sslContext,
+ int port,
+ int backlog,
+ java.net.InetAddress ifAddress)
+Gets the SSL Server socket for the specified
+SSLContext , port, backlog and InetAddress . |
+
static java.security.KeyStore |
+loadKeyStore(java.lang.String type,
+ java.io.File file,
+ java.lang.String password)
+Loads a Keystore of a certain type from a file given the password.
+ |
+
static javax.net.ssl.SSLSocket |
+upgradeClientSocketToSSL(javax.net.ssl.SSLContext sslContext,
+ java.net.Socket socket,
+ java.lang.String host,
+ int port,
+ boolean autoClose)
+Upgrades an existing
+Socket to an SSLSocket using the specified SSLContext ,
+ Socket , host, port and if the specified socket should be closed when the returned socket is closed. |
+
static javax.net.ssl.SSLSocket |
+upgradeClientSocketToSSL(javax.net.ssl.SSLContext sslContext,
+ java.net.Socket socket,
+ java.lang.String host,
+ int port,
+ boolean autoClose,
+ boolean onClient)
+Upgrades an existing
+Socket to an SSLSocket using the specified SSLContext ,
+ Socket , host, port and if the specified socket should be closed when the returned socket is closed. |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static java.security.KeyStore loadKeyStore(java.lang.String type, + java.io.File file, + java.lang.String password) + throws SSLUtilityException+
type
- The type of keystore (pass null for the default type).file
- The file to load the keystore from.password
- The password of the keystore (Can be null).java.lang.NullPointerException
- file is null.SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLContext getSSLContextNoJRETrust(java.lang.String algorithmName, + java.security.KeyStore unifiedKeyStore, + char[] keyStorePassword) + throws SSLUtilityException+
KeyStore
.algorithmName
- The name of the context protocol or null for the JRE Default (TLSv1).unifiedKeyStore
- The keystore for use with the private and trust stores.keyStorePassword
- The password of the key store or null (Use "changeit" for JKS keystore defaults).SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLContext getSSLContextNoJRETrust(java.lang.String algorithmName, + java.security.KeyStore privateKeyStore, + char[] privateKeyStorePassword, + java.security.KeyStore trustKeyStore) + throws SSLUtilityException+
KeyStore
s.algorithmName
- The name of the context protocol or null for the JRE Default (TLSv1).privateKeyStore
- The keystore for use with the private store.privateKeyStorePassword
- The password of the private key store or null (Use "changeit" for JKS keystore defaults).trustKeyStore
- The keystore for use with the trust store.SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLContext getSSLContext(java.lang.String algorithmName, + java.security.KeyStore unifiedKeyStore, + char[] keyStorePassword) + throws SSLUtilityException+
KeyStore
.algorithmName
- The name of the context protocol or null for the JRE Default (TLSv1).unifiedKeyStore
- The keystore for use with the private and trust stores.keyStorePassword
- The password of the key store or null (Use "changeit" for JKS keystore defaults).SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLContext getSSLContext(java.lang.String algorithmName, + java.security.KeyStore privateKeyStore, + char[] privateKeyStorePassword, + java.security.KeyStore trustKeyStore) + throws SSLUtilityException+
KeyStore
s.algorithmName
- The name of the context protocol or null for the JRE Default (TLSv1).privateKeyStore
- The keystore for use with the private store.privateKeyStorePassword
- The password of the private key store or null (Use "changeit" for JKS keystore defaults).trustKeyStore
- The keystore for use with the trust store.SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLSocket getSSLClientSocket(javax.net.ssl.SSLContext sslContext, + java.lang.String host, + int port) + throws SSLUtilityException+
SSLSocket
using the specified SSLContext
, host and port.sslContext
- The SSL Context to create the socket from.host
- The host to connect to.port
- The port to connect to.SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLSocket upgradeClientSocketToSSL(javax.net.ssl.SSLContext sslContext, + java.net.Socket socket, + java.lang.String host, + int port, + boolean autoClose) + throws SSLUtilityException+
Socket
to an SSLSocket
using the specified SSLContext
,
+ Socket
, host, port and if the specified socket should be closed when the returned socket is closed.
+ This socket is in client mode (Upgrade for client side).sslContext
- The SSL Context to create the socket from.socket
- The socket to wrap.host
- The host to "connect" to.port
- The port to "connect" to.autoClose
- If the underlying socket should be closed when the returned socket is closed.SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLSocket upgradeClientSocketToSSL(javax.net.ssl.SSLContext sslContext, + java.net.Socket socket, + java.lang.String host, + int port, + boolean autoClose, + boolean onClient) + throws SSLUtilityException+
Socket
to an SSLSocket
using the specified SSLContext
,
+ Socket
, host, port and if the specified socket should be closed when the returned socket is closed.sslContext
- The SSL Context to create the socket from.socket
- The socket to wrap.host
- The host to "connect" to.port
- The port to "connect" to.autoClose
- If the underlying socket should be closed when the returned socket is closed.onClient
- Is this being called on the client side.SSLUtilityException
- An Exception has occurred.public static javax.net.ssl.SSLServerSocket getSSLServerSocket(javax.net.ssl.SSLContext sslContext, + int port, + int backlog, + java.net.InetAddress ifAddress) + throws SSLUtilityException+
SSLContext
, port, backlog and InetAddress
.sslContext
- The SSL Context to create the socket from.port
- The port to listen on.backlog
- The number of connections that can be queued.ifAddress
- The network interface to listen on (null means listen on all network interfaces).SSLUtilityException
- An Exception has occurred.public class SSLUtilityException
+extends java.lang.Exception
+Throwable.getCause()
to find out the underlying exception.Constructor and Description | +
---|
SSLUtilityException(java.lang.String message)
+Constructs a new exception with the specified detail message.
+ |
+
SSLUtilityException(java.lang.String message,
+ java.lang.Throwable cause)
+Constructs a new exception with the specified detail message and
+ cause.
+ |
+
SSLUtilityException(java.lang.Throwable cause)
+Constructs a new exception with the specified cause and a detail
+ message of (cause==null ? null : cause.toString()) (which
+ typically contains the class and detail message of cause).
+ |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public SSLUtilityException(java.lang.String message)+
Throwable.initCause(java.lang.Throwable)
.message
- the detail message. The detail message is saved for
+ later retrieval by the Throwable.getMessage()
method.public SSLUtilityException(java.lang.String message, + java.lang.Throwable cause)+
Note that the detail message associated with
+ cause
is not automatically incorporated in
+ this exception's detail message.
message
- the detail message (which is saved for later retrieval
+ by the Throwable.getMessage()
method).cause
- the cause (which is saved for later retrieval by the
+ Throwable.getCause()
method). (A null value is
+ permitted, and indicates that the cause is nonexistent or
+ unknown.)public SSLUtilityException(java.lang.Throwable cause)+
PrivilegedActionException
).cause
- the cause (which is saved for later retrieval by the
+ Throwable.getCause()
method). (A null value is
+ permitted, and indicates that the cause is nonexistent or
+ unknown.)Socket
s and creating SSLContext
s.See: Description
+Class | +Description | +
---|---|
SSLUtilities | +
+ This class provides SSL utilities to create
+SSLContext and SSLSocket
+ objects using JKS files (Or other supported formats). |
+
Exception | +Description | +
---|---|
SSLUtilityException | +
+ This class provides the SSL Utility exception wrapper class.
+ |
+
Socket
s and creating SSLContext
s.public class LengthClampedInputStream
+extends java.io.FilterInputStream
+Constructor and Description | +
---|
LengthClampedInputStream(java.io.InputStream inputStream,
+ int length)
+Creates a LengthClampedInputStream with the specified
+InputStream
+ and the maximum number of bytes that can be read from the stream. |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+available()
+Returns an estimate of the number of bytes that can be read (or
+ skipped over) from this input stream without blocking by the next
+ caller of a method for this input stream.
+ |
+
void |
+close()
+Closes this input stream and releases any system resources
+ associated with the stream.
+ |
+
void |
+mark(int readlimit)
+Marks the current position in this input stream.
+ |
+
int |
+read()
+Reads the next byte of data from this input stream.
+ |
+
void |
+reset()
+Repositions this stream to the position at the time the
+
+mark method was last called on this input stream. |
+
void |
+setClampedLength(int clampedLength)
+Sets a new clamped length value.
+ |
+
markSupported, read, read, skip
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public LengthClampedInputStream(java.io.InputStream inputStream, + int length)+
InputStream
+ and the maximum number of bytes that can be read from the stream.inputStream
- The input stream to clamp.length
- The maximum number of bytes that can be read before end of stream is reached.java.lang.NullPointerException
- inputStream is null.java.lang.IllegalArgumentException
- length is less than 0.public int read() + throws java.io.IOException+
int
in the range
+ 0
to 255
. If no byte is available
+ because the end of the stream has been reached, the value
+ -1
is returned. This method blocks until input data
+ is available, the end of the stream is detected, or an exception
+ is thrown.read
in class java.io.FilterInputStream
-1
if the end of the
+ stream is reached.java.io.IOException
- if an I/O error occurs.public int available() + throws java.io.IOException+
available
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurs.public void mark(int readlimit)+
reset
method repositions this stream at
+ the last marked position so that subsequent reads re-read the same bytes.
+
+ The readlimit
argument tells this input stream to
+ allow that many bytes to be read before the mark position gets
+ invalidated.
mark
in class java.io.FilterInputStream
readlimit
- the maximum limit of bytes that can be read before
+ the mark position becomes invalid.public void reset() + throws java.io.IOException+
mark
method was last called on this input stream.
+ + Stream marks are intended to be used in + situations where you need to read ahead a little to see what's in + the stream. Often this is most easily done by invoking some + general parser. If the stream is of the type handled by the + parse, it just chugs along happily. If the stream is not of + that type, the parser should toss an exception when it fails. + If this happens within readlimit bytes, it allows the outer + code to reset the stream and try another parser.
reset
in class java.io.FilterInputStream
java.io.IOException
- if the stream has not been marked, if the
+ mark has been invalidated or marking is not supported.public void close() + throws java.io.IOException+
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurs.public void setClampedLength(int clampedLength)+
clampedLength
- The new clamped length value.java.lang.IllegalArgumentException
- clampedLength is less than 0.public class NetworkInputStream
+extends java.io.InputStream
+Socket
s or DatagramSocket
s.Constructor and Description | +
---|
NetworkInputStream(java.net.DatagramSocket socketIn)
+Constructs a new NetworkInputStream with the specified
+DatagramSocket . |
+
NetworkInputStream(java.net.Socket socketIn)
+Constructs a new NetworkInputStream with the specified
+Socket . |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+available()
+Returns an estimate of the number of bytes that can be read (or
+ skipped over) from this input stream without blocking by the next
+ invocation of a method for this input stream.
+ |
+
void |
+close()
+Closes this input stream and releases any system resources associated
+ with the stream.
+ |
+
java.net.InetAddress |
+getAddress()
+Gets the current
+InetAddress of the stream. |
+
java.net.DatagramSocket |
+getDatagramSocket()
+Gets the datagram socket in use or null.
+ |
+
java.net.InetAddress |
+getLocalAddress()
+Gets the local
+InetAddress of the stream. |
+
java.lang.Integer |
+getLocalPort()
+Gets the local port of the stream.
+ |
+
int |
+getPacketSize()
+Gets the current datagram packet size.
+ |
+
java.lang.Integer |
+getPort()
+Gets the current port of the stream.
+ |
+
java.net.Socket |
+getSocket()
+Gets the socket in use or null.
+ |
+
int |
+read()
+Reads the next byte of data from the input stream.
+ |
+
byte[] |
+readPacket()
+Reads a single datagram packet.
+ |
+
int |
+readPacket(byte[] b)
+Reads a single datagram packet into the specified buffer storing with no offset.
+ |
+
int |
+readPacket(byte[] b,
+ int off,
+ int len)
+Reads a single datagram packet into the specified buffer
+ storing from the specified offset and the specified number of bytes.
+ |
+
void |
+setDatagramSocket(java.net.DatagramSocket socketIn)
+Sets the datagram socket in use.
+ |
+
void |
+setSocket(java.net.Socket socketIn)
+Sets the socket in use.
+ |
+
mark, markSupported, read, read, reset, skip
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetworkInputStream(java.net.Socket socketIn)+
Socket
.socketIn
- The socket to use.java.lang.NullPointerException
- socketIn is null.public NetworkInputStream(java.net.DatagramSocket socketIn)+
DatagramSocket
.socketIn
- The datagram socket to use.java.lang.NullPointerException
- socketIn is null.public int read() + throws java.io.IOException+
int
in the range 0
to
+ 255
. If no byte is available because the end of the stream
+ has been reached, the value -1
is returned. This method
+ blocks until input data is available, the end of the stream is detected,
+ or an exception is thrown.read
in class java.io.InputStream
-1
if the end of the
+ stream is reached.java.io.IOException
- if an I/O error occurs.public byte[] readPacket() + throws java.io.IOException+
java.io.IOException
- if an I/O error occurs, stream closed or not using a datagram socket.public int readPacket(byte[] b) + throws java.io.IOException+
b
- The buffer to store the packet in.java.lang.NullPointerException
- b is null.java.io.IOException
- if an I/O error occurs, stream closed or not using a datagram socket.public int readPacket(byte[] b, + int off, + int len) + throws java.io.IOException+
b
- The buffer to store the packet in.off
- The offset to store in the buffer from.len
- The number of bytes to store in the buffer.java.lang.NullPointerException
- b is null.java.lang.IndexOutOfBoundsException
- if off is negative, len is negative, or len is greater than the difference of the length of the buffer and off.java.io.IOException
- if an I/O error occurs, stream closed or not using a datagram socket.public int getPacketSize() + throws java.io.IOException+
java.io.IOException
- stream closed or not using a datagram socket.public java.net.InetAddress getAddress()+
InetAddress
of the stream.
+ Can be null.public java.lang.Integer getPort()+
public java.net.InetAddress getLocalAddress()+
InetAddress
of the stream.
+ Can be null.public java.lang.Integer getLocalPort()+
public java.net.Socket getSocket()+
public void setSocket(java.net.Socket socketIn) + throws java.io.IOException+
socketIn
- The socket to now use.java.lang.NullPointerException
- socketIn is null.java.io.IOException
- stream closed or not using a socket.public java.net.DatagramSocket getDatagramSocket()+
public void setDatagramSocket(java.net.DatagramSocket socketIn) + throws java.io.IOException+
socketIn
- The datagram socket to now use.java.lang.NullPointerException
- socketIn is null.java.io.IOException
- stream closed or not using a datagram socket.public int available() + throws java.io.IOException+
available
in class java.io.InputStream
0
when
+ it reaches the end of the input stream.java.io.IOException
- if an I/O error occurs.public void close() + throws java.io.IOException+
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.public class NetworkOutputStream
+extends java.io.OutputStream
+Socket
s or DatagramSocket
s.Constructor and Description | +
---|
NetworkOutputStream(java.net.DatagramSocket socketIn)
+Constructs a new NetworkOutputStream with the specified
+DatagramSocket . |
+
NetworkOutputStream(java.net.DatagramSocket socketIn,
+ int size)
+Constructs a new NetworkOutputStream with the specified
+DatagramSocket and datagram buffer size. |
+
NetworkOutputStream(java.net.DatagramSocket socketIn,
+ int size,
+ java.net.InetAddress address,
+ int port)
+Constructs a new NetworkOutputStream with the specified
+DatagramSocket , datagram buffer size, InetAddress target and port target. |
+
NetworkOutputStream(java.net.Socket socketIn)
+Constructs a new NetworkOutputStream with the specified
+Socket . |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+canDatagramBufferBeSet()
+Gets if the
+setDatagramBufferSize(int) can be used. |
+
void |
+close()
+Closes this output stream and releases any system resources
+ associated with this stream.
+ |
+
void |
+flush()
+Flushes this output stream and forces any buffered output bytes
+ to be written out.
+ |
+
java.net.InetAddress |
+getAddress()
+Gets the current
+InetAddress of the stream. |
+
java.net.DatagramSocket |
+getDatagramSocket()
+Gets the datagram socket in use or null.
+ |
+
java.net.InetAddress |
+getLocalAddress()
+Gets the local
+InetAddress of the stream. |
+
java.lang.Integer |
+getLocalPort()
+Gets the local port of the stream.
+ |
+
java.lang.Integer |
+getPort()
+Gets the current port of the stream.
+ |
+
java.net.Socket |
+getSocket()
+Gets the socket in use or null.
+ |
+
void |
+setDatagramBufferSize(int size)
+Sets the buffer size for sending datagrams.
+ |
+
void |
+setDatagramSocket(java.net.DatagramSocket socketIn)
+Sets the datagram socket in use.
+ |
+
void |
+setDatagramTarget(java.net.InetAddress address,
+ int port)
+Sets the datagram target
+InetAddress and port. |
+
void |
+setSocket(java.net.Socket socketIn)
+Sets the socket in use.
+ |
+
void |
+write(int b)
+Writes the specified byte to this output stream.
+ |
+
write, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public NetworkOutputStream(java.net.Socket socketIn)+
Socket
.socketIn
- The socket to use.java.lang.NullPointerException
- socketIn is null.public NetworkOutputStream(java.net.DatagramSocket socketIn)+
DatagramSocket
.socketIn
- The datagram socket to use.java.lang.NullPointerException
- socketIn is null.public NetworkOutputStream(java.net.DatagramSocket socketIn, + int size)+
DatagramSocket
and datagram buffer size.socketIn
- The datagram socket to use.size
- The size of the buffer.java.lang.NullPointerException
- socketIn is null.java.lang.IllegalArgumentException
- size is less than 1 or greater than 65535.public NetworkOutputStream(java.net.DatagramSocket socketIn, + int size, + java.net.InetAddress address, + int port)+
DatagramSocket
, datagram buffer size, InetAddress
target and port target.socketIn
- The datagram socket to use.size
- The size of the buffer.address
- The target address to set to.port
- The target port to set to.java.lang.NullPointerException
- socketIn or address is null.java.lang.IllegalArgumentException
- size is less than 1 or greater than 65535 or port is less than 0 or greater than 65535.public boolean canDatagramBufferBeSet()+
setDatagramBufferSize(int)
can be used.public void setDatagramBufferSize(int size) + throws java.io.IOException+
size
- The size to set to.java.lang.IllegalArgumentException
- size is less than 1 or greater than 65535.java.io.IOException
- a datagram socket is not in use, buffer index is not null or the stream is closed.public void setDatagramTarget(java.net.InetAddress address, + int port) + throws java.io.IOException+
InetAddress
and port.address
- The address to set to.port
- The port to set to.java.lang.NullPointerException
- address is null.java.lang.IllegalArgumentException
- port is less than 0 or greater than 65535.java.io.IOException
- a datagram socket is not in use or the stream is closed.public void write(int b) + throws java.io.IOException+
write
is that one byte is written
+ to the output stream. The byte to be written is the eight
+ low-order bits of the argument b
. The 24
+ high-order bits of b
are ignored.write
in class java.io.OutputStream
b
- the byte
.java.io.IOException
- if an I/O error occurs. In particular,
+ an IOException
will be thrown if the
+ output stream has been closed.public java.net.InetAddress getAddress()+
InetAddress
of the stream.
+ Can be null.public java.lang.Integer getPort()+
public java.net.InetAddress getLocalAddress()+
InetAddress
of the stream.
+ Can be null.public java.lang.Integer getLocalPort()+
public java.net.Socket getSocket()+
public void setSocket(java.net.Socket socketIn) + throws java.io.IOException+
socketIn
- The socket to now use.java.lang.NullPointerException
- socketIn is null.java.io.IOException
- stream closed or not using a socket.public java.net.DatagramSocket getDatagramSocket()+
public void setDatagramSocket(java.net.DatagramSocket socketIn) + throws java.io.IOException+
socketIn
- The datagram socket to now use.java.lang.NullPointerException
- socketIn is null.java.io.IOException
- stream closed or not using a datagram socket.public void flush() + throws java.io.IOException+
flush
is
+ that calling it is an indication that, if any bytes previously
+ written have been buffered by the implementation of the output
+ stream, such bytes should immediately be written to their
+ intended destination.flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
- if an I/O error occurs.public void close() + throws java.io.IOException+
close
+ is that it closes the output stream. A closed stream cannot perform
+ output operations and cannot be reopened. The underlying socket is closed.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
- if an I/O error occurs.See: Description
+Class | +Description | +
---|---|
LengthClampedInputStream | +
+ This class provides the ability to limit the number of bytes read from the underlying stream.
+ |
+
NetworkInputStream | +
+ This class provides a Network Input stream for either
+Socket s or DatagramSocket s. |
+
NetworkOutputStream | +
+ This class provides a Network Output stream for either
+Socket s or DatagramSocket s. |
+
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object
. The interfaces do not inherit from java.lang.Object
.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+IPacket
s being read.IPacket
s.CALMNETPacketFactory.getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.InputStream
+ and the maximum number of bytes that can be read from the stream.InetAddress
.InetAddress
.NetMarshalClient
.Socket
, IPacketFactory
, PacketLoader
and FragmentationOptions
.MulticastSocket
, multicast group InetAddress
, multicast port, IPacketFactory
, PacketLoader
and FragmentationOptions
.DatagramSocket
, remote InetAddress
, remote port, InputStream
, IPacketFactory
, PacketLoader
and FragmentationOptions
.DatagramSocket
, remote InetAddress
, remote port, IPacketFactory
, PacketLoader
and FragmentationOptions
.Socket
, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.MulticastSocket
, multicast group InetAddress
, multicast port, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.DatagramSocket
, remote InetAddress
, remote port, InputStream
, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.DatagramSocket
, remote InetAddress
, remote port, IPacketFactory
,
+ PacketLoader
, FragmentationOptions
, Function
for wrapping the input stream and the Function
for wrapping the output stream.NetMarshalClient
s.ServerSocket
, IPacketFactory
, PacketLoader
and FragmentationOptions
.DatagramSocket
, IPacketFactory
, PacketLoader
and FragmentationOptions
.NetMarshalClient
s, allows stream wrapping.ServerSocket
, IPacketFactory
, PacketLoader
, FragmentationOptions
,
+ Function
for wrapping the input stream and the Function
for wrapping the output stream.DatagramSocket
, IPacketFactory
, PacketLoader
, FragmentationOptions
,
+ Function
for wrapping the input stream and the Function
for wrapping the output stream.ICipherFactory
.Socket
s or DatagramSocket
s.Socket
.DatagramSocket
.Socket
s or DatagramSocket
s.Socket
.DatagramSocket
.DatagramSocket
and datagram buffer size.DatagramSocket
, datagram buffer size, InetAddress
target and port target.DigestProvider
.IPacket
.InputStream
.InputStream
.OutputStream
.OutputStream
.OutputStream
.OutputStream
.InputStream
.IPacket
from an input stream.IPacket
from a byte array (No digest support).IPacket
from an input stream (No digest support).IStreamedPacket
from an input stream.IStreamedPacket
from an input stream (No digest support).IPacket
.IPacket
from the FragmentReceiver.IPacket
into the FragmentReceiver.IPacket
into the FragmentSender.IPacket
polled.IPacket
from the FragmentReceiver.InetAddress
.mark
method was last called on this input stream.PacketProtocolInformation
of the packet.IPacket
.IPacket
s from the FragmentReceiver.IPacket
using this FragmentSender.IPacket
s from the FragmentSender.BiConsumer
accept exception consumer.ICipherFactory
being used.ICipherFactory
being used.ICipherFactory
in use.BiConsumer
client acceptance consumer.Consumer
closed consumer.Consumer
closed consumer.InetAddress
and port.IPacketFactory
to use.IPacketFactory
to use.FragmentReceiver.sendPacket()
calls, that return null, to a registry entry are made before
+ the FragmentSendCompletePacket
or FragmentRetrySendPacket
packets are sent.Consumer
opened consumer.IPacket
in use.IPacketFactory
in use (null signifies to use the same instance).IPacketFactory
to use.PacketLoader
to use.PacketLoader
to use.PacketLoader
to use.PacketLoader
to use.PacketLoader
to use.IPacket
s should be read.BiConsumer
receiver consumer.BiConsumer
receiver consumer.BiConsumer
receive exception consumer.BiConsumer
receive exception consumer.BiConsumer
socket setup consumer.CALMNETPacketFactory.getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.getPacket(PacketProtocolInformation)
prefers returning IStreamedPacket
s if possible.EncryptedPacket
and Base64Packet
.FragmentReceiver
with parameters.FragmentSender
with parameters.SSLContext
and SSLSocket
+ objects using JKS files (Or other supported formats).FragmentReceiver.shouldSentDataBeAllVerified()
is true.FragmentSender.shouldSentDataBeAllVerified()
is true.FragmentReceiver.shouldSentDataBeAllVerified()
is true.FragmentSender.shouldSentDataBeAllVerified()
is true.Socket
to an SSLSocket
using the specified SSLContext
,
+ Socket
, host, port and if the specified socket should be closed when the returned socket is closed.Socket
to an SSLSocket
using the specified SSLContext
,
+ Socket
, host, port and if the specified socket should be closed when the returned socket is closed.InputStream
.InputStream
.InputStream
.InputStream
.OutputStream
using 4 bytes.IPacket
to an output stream (No digest support).IPacket
to a byte array (No digest support).IPacket
to an output stream.IPacket
.IPacketFactory
and PacketLoader
.IPacketFactory
, PacketLoader
+ and if the encrypted data should be cached.IPacketFactory
, PacketLoader
,
+ IPacket
and if the encrypted data should be cached.IPacket
.IPacketFactory
for calmnet packets.IStreamedPacket
s are preferred and the specified PacketLoader
.IStreamedPacket
s are preferred, the specified PacketLoader
and the IPacketFactory
.IPacketFactory
for calmnet packets
+ with the ability to set the IPacket
of supporting packets.IStreamedPacket
s are preferred and the specified PacketLoader
.IStreamedPacket
s are preferred, the specified PacketLoader
and the IPacketFactory
.NetworkOutputStream.setDatagramBufferSize(int)
can be used.NetMarshalServer
s.IPacket
s on sockets.IPacketFactory
interface and standard classes.FragmentReceiver
and FragmentSender
objects.Socket
s and creating SSLContext
s.IPacket
.IPacketFactory
, PacketLoader
and ICipherFactory
.IPacketFactory
, PacketLoader
, ICipherFactory
+ and if the encrypted data should be cached.IPacketFactory
, PacketLoader
, ICipherFactory
and IPacket
.IPacketFactory
, PacketLoader
, ICipherFactory
,
+ IPacket
and if the encrypted data should be cached.FragmentAllocatePacket
.FragmentSender
s and
+ FragmentReceiver
s in this package.FragmentMessagePacket
.com.captainalm.lib.calmnet.packet.fragment
.PacketLoader
and IPacketFactory
.com.captainalm.lib.calmnet.packet.fragment
.PacketLoader
.PacketLoader
+ and packet split size in bytes.FragmentSender
.BiConsumer
accept exception consumer.InetAddress
of the stream.InetAddress
of the stream.ICipherFactory
being used.ICipherFactory
being used or null.ICipherFactory
in use (Could be the same instance).BiConsumer
client acceptance consumer.Consumer
closed consumer.Consumer
closed consumer.NetMarshalClient
s.IPacketFactory
in use.IPacketFactory
in use.FragmentationOptions
of the client.FragmentationOptions
of the client.DigestProvider
to use for the payload of the packets on the trailer.InetAddress
of the stream.InetAddress
of the stream.FragmentReceiver.sendPacket()
calls, that return null, to a registry entry are made before
+ the FragmentSendCompletePacket
or FragmentRetrySendPacket
packets are sent.Consumer
opened consumer.IPacket
of the protocol specified by the passed PacketProtocolInformation
instance.IPacket
of the protocol specified by the passed PacketProtocolInformation
instance.IPacket
in use (Could be the same instance).IPacket
of the protocol specified by the passed PacketProtocolInformation
instance.IPacketFactory
in use (Could be the same instance).IPacketFactory
in use.PacketLoader
in use.PacketLoader
in use.PacketLoader
in use.PacketLoader
in use.PacketLoader
in use.PacketProtocolInformation
of the packet.BiConsumer
receiver consumer.BiConsumer
receiver consumer.BiConsumer
receive exception consumer.BiConsumer
receive exception consumer.BiConsumer
socket setup consumer.SSLSocket
using the specified SSLContext
, host and port.KeyStore
.KeyStore
s.KeyStore
.KeyStore
s.SSLContext
, port, backlog and InetAddress
.Function
input stream wrapper function.Function
input stream wrapper function.Function
output stream wrapper function.Function
output stream wrapper function.IPacket
s given their PacketProtocolInformation
.EncryptedPacket
and Base64Packet
.+ + diff --git a/JavaDoc/overview-summary.html b/JavaDoc/overview-summary.html new file mode 100644 index 0000000..6132965 --- /dev/null +++ b/JavaDoc/overview-summary.html @@ -0,0 +1,173 @@ + + + + + +
Package | +Description | +
---|---|
com.captainalm.lib.calmnet.marshal | +
+ This package contains the network marshals for managed sending of
+IPacket s on sockets. |
+
com.captainalm.lib.calmnet.packet | +
+ This package contains the network packets and handling code.
+ |
+
com.captainalm.lib.calmnet.packet.core | +
+ This package contains the core network packets.
+ |
+
com.captainalm.lib.calmnet.packet.factory | +
+ This package contains the
+IPacketFactory interface and standard classes. |
+
com.captainalm.lib.calmnet.packet.fragment | +
+ This package contains the fragment network packets and
+ the
+FragmentReceiver and FragmentSender objects. |
+
com.captainalm.lib.calmnet.ssl | +
+ This package provides SSL utilities for wrapping
+
+Socket s and creating SSLContext s. |
+
com.captainalm.lib.calmnet.stream | +
+ This package provides streams for network packet streaming.
+ |
+