public final class MultiplexFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
EVENT_PACKET_CLOSED
The event constant that is used to signal that a packet
connector has been closed.
|
static int |
EVENT_PACKET_OPENED
The event constant that is used to signal that a new packet
connector has been created.
|
static int |
EVENT_PACKET_RECEIVED
The event constant that is used to signal that a new packet
has been received.
|
static int |
EVENT_STREAM_CLOSED
The event constant that is used to signal that a stream
connector has been closed.
|
static int |
EVENT_STREAM_OPENED
The event constant that is used to signal that a stream
connector has been opened.
|
static int |
EVENT_STREAM_RECEIVED
The event constant that is used to signal that a stream
connector has received some data.
|
Constructor and Description |
---|
MultiplexFactory(IMultiplexPlugin plugin,
java.io.InputStream input,
java.io.OutputStream output)
Creates a new multiplexer with the specified input and output
stream.
|
MultiplexFactory(IMultiplexPlugin plugin,
java.io.InputStream input,
java.io.OutputStream output,
boolean acknowledged)
Creates a new multiplexer with the specified input and output
stream.
|
MultiplexFactory(IMultiplexPlugin plugin,
java.io.InputStream input,
java.io.OutputStream output,
boolean acknowledged,
int size)
Creates a new multiplexer with the specified input and output
stream.
|
Modifier and Type | Method and Description |
---|---|
void |
addMultiplexListener(int types,
IListener listener)
Adds a multiplex listener to the set of registered listeners.
|
void |
close()
Closes the multiplexer and performs the necessary cleanup by
shutting down the streams.
|
IStreamConnector |
openConnector()
Creates a new stream connector that is connected through a
stream connector on the other end of the streams.
|
IPacketConnector |
openConnector(short group)
Creates a packet connector that is connected to the specified
group.
|
boolean |
removeMultiplexListener(int types,
IListener listener)
Removes a previously registered listener from the set of registered
listeners.
|
public static final int EVENT_PACKET_OPENED
public static final int EVENT_PACKET_RECEIVED
public static final int EVENT_PACKET_CLOSED
public static final int EVENT_STREAM_OPENED
public static final int EVENT_STREAM_RECEIVED
public static final int EVENT_STREAM_CLOSED
public MultiplexFactory(IMultiplexPlugin plugin, java.io.InputStream input, java.io.OutputStream output)
plugin
- The plug-in that uses the multiplexer. This plug-in
will be issued as responsible plug-in whenever a connector is
requested for its plug-in.input
- The input stream used by the multiplexer.output
- The output stream used by the multiplexer.public MultiplexFactory(IMultiplexPlugin plugin, java.io.InputStream input, java.io.OutputStream output, boolean acknowledged)
plugin
- The plug-in that uses the multiplexer. This plug-in
will be issued as responsible plug-in whenever a connector is
requested for its plug-in.input
- The input stream used by the multiplexer.output
- The output stream used by the multiplexer.acknowledged
- A flag that enables a stop and wait
protocol for application layer flow control on nokia series
60 mobile phones.public MultiplexFactory(IMultiplexPlugin plugin, java.io.InputStream input, java.io.OutputStream output, boolean acknowledged, int size)
plugin
- The plug-in that uses the multiplexer. This plug-in
will be issued as responsible plug-in whenever a connector is
requested for its plug-in.input
- The input stream used by the multiplexer.output
- The output stream used by the multiplexer.acknowledged
- A flag that enables a stop and wait
protocol for application layer flow control on nokia series
60 mobile phones.size
- The size of the maximum data unit. Note that 10 additional
bytes may be used due to the header sizes. This has been added
for sun spots as they can only buffer 255 bytes reliably.public void addMultiplexListener(int types, IListener listener)
types
- The types of events to register for.listener
- The listener to register for.public boolean removeMultiplexListener(int types, IListener listener)
types
- The types of events to unregister.listener
- The listener to unregister.public IPacketConnector openConnector(short group) throws java.io.IOException
group
- The group that the packet connector should be in.java.io.IOException
- Thrown if the connector cannot be opened,
this indicates that the streams are malfunctioning.public IStreamConnector openConnector() throws java.io.IOException
java.io.IOException
- Thrown if the connector cannot be opened,
this indicates that the streams are malfunctioning or that
the receiving end of the connector did not respond.public void close()