public abstract class StringSocketHandler extends java.lang.Object implements SocketHandler
The idea of a String handler is to connect either to send some of data or receive some sort of data. It should only be used once and is run synchronously. There isn't even any event firing method because of its simplicity (hence you can't run it asynchronously anyways).
The use of this class is very simple. It is usually used to test connections or to do a one-time request deal such as connecting to a server that returns a request and closes the connection (ie. connecting to a time server to retrieve the current time). For more advanced functionality, you can add your own.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
data |
protected int |
maxLength |
static int |
MAXLENGTH |
static int |
SOCKETBUF |
| Constructor and Description |
|---|
StringSocketHandler() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getData() |
int |
getMaxLength() |
void |
setData(java.lang.String data) |
void |
setMaxLength(int length) |
void |
shutdown()
Does nothing since there's nothing to shutdown as the connection is being run synchronously.
|
void |
start()
starts the connection.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithandlepublic static final int MAXLENGTH
public static final int SOCKETBUF
protected int maxLength
protected java.lang.String data
public void setMaxLength(int length)
public int getMaxLength()
public void shutdown()
shutdown in interface SocketHandlerpublic void start()
SocketHandlerstart in interface SocketHandlerpublic void setData(java.lang.String data)
public java.lang.String getData()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2001-2005 Echomine. All Rights Reserved.