de.mud.jta.plugin
Class Socket
java.lang.Object
|
+--de.mud.jta.Plugin
|
+--de.mud.jta.plugin.Socket
- All Implemented Interfaces:
- FilterPlugin, PluginListener, SocketListener
- public class Socket
- extends Plugin
- implements FilterPlugin, SocketListener
The socket plugin acts as the data source for networked operations.
Maintainer: Matthias L. Jugel
- Version:
- $Id: Socket.java,v 2.10 2000/05/26 06:08:16 leo Exp $
- Author:
- Matthias L. Jugel, Marcus Meißner
Field Summary |
protected java.io.InputStream |
in
|
protected java.io.OutputStream |
out
|
protected java.lang.String |
relay
|
protected int |
relayPort
|
protected java.net.Socket |
socket
|
Constructor Summary |
Socket(PluginBus bus,
java.lang.String id)
Create a new socket plugin. |
Method Summary |
void |
connect(java.lang.String host,
int port)
Connect to the host and port passed. |
void |
disconnect()
Disconnect the socket and close the connection. |
int |
read(byte[] b)
Read a block of data from the back end. |
void |
setFilterSource(FilterPlugin plugin)
Set the source plugin where we get our data from and where the data
sink (write) is. |
void |
write(byte[] b)
Write a block of data to the back end. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
socket
protected java.net.Socket socket
in
protected java.io.InputStream in
out
protected java.io.OutputStream out
relay
protected java.lang.String relay
relayPort
protected int relayPort
Socket
public Socket(PluginBus bus,
java.lang.String id)
- Create a new socket plugin.
connect
public void connect(java.lang.String host,
int port)
throws java.io.IOException
- Connect to the host and port passed. If the multi relayd (mrelayd) is
used to allow connections to any host and the Socket.relay property
is configured this method will connect to the relay first, send
off the string "relay host port\n" and then the real connection will
be published to be online.
- Specified by:
connect
in interface SocketListener
disconnect
public void disconnect()
throws java.io.IOException
- Disconnect the socket and close the connection.
- Specified by:
disconnect
in interface SocketListener
setFilterSource
public void setFilterSource(FilterPlugin plugin)
- Description copied from interface:
FilterPlugin
- Set the source plugin where we get our data from and where the data
sink (write) is. The actual data handling should be done in the
read() and write() methods.
- Specified by:
setFilterSource
in interface FilterPlugin
- Following copied from interface:
de.mud.jta.FilterPlugin
- Parameters:
source
- the data source
read
public int read(byte[] b)
throws java.io.IOException
- Description copied from interface:
FilterPlugin
- Read a block of data from the back end.
- Specified by:
read
in interface FilterPlugin
- Following copied from interface:
de.mud.jta.FilterPlugin
- Parameters:
b
- the buffer to read the data into- Returns:
- the amount of bytes actually read
write
public void write(byte[] b)
throws java.io.IOException
- Description copied from interface:
FilterPlugin
- Write a block of data to the back end.
- Specified by:
write
in interface FilterPlugin
- Following copied from interface:
de.mud.jta.FilterPlugin
- Parameters:
b
- the buffer to be sent