com.echomine.net
Class StringSocketHandler
java.lang.Object
com.echomine.net.StringSocketHandler
- All Implemented Interfaces:
- SocketHandler
- Direct Known Subclasses:
- StringSocketReaderHandler, StringSocketWriterHandler
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.
Method Summary |
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()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MAXLENGTH
public static final int MAXLENGTH
- See Also:
- Constant Field Values
SOCKETBUF
public static final int SOCKETBUF
- See Also:
- Constant Field Values
maxLength
protected int maxLength
data
protected java.lang.String data
StringSocketHandler
public StringSocketHandler()
setMaxLength
public void setMaxLength(int length)
getMaxLength
public int getMaxLength()
shutdown
public void shutdown()
- Does nothing since there's nothing to shutdown as the connection is being run synchronously.
- Specified by:
shutdown
in interface SocketHandler
start
public void start()
- Description copied from interface:
SocketHandler
- starts the connection. This will give the handler a chance to reset
any information or create any instances before the handling begins.
- Specified by:
start
in interface SocketHandler
setData
public void setData(java.lang.String data)
getData
public java.lang.String getData()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2001-2005 Echomine. All Rights Reserved.