com.echomine.net
Class StringSocketHandler

java.lang.Object
  extended by 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.


Field Summary
protected  java.lang.String data
           
protected  int maxLength
           
static int MAXLENGTH
           
static int SOCKETBUF
           
 
Constructor Summary
StringSocketHandler()
           
 
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
 
Methods inherited from interface com.echomine.net.SocketHandler
handle
 

Field Detail

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
Constructor Detail

StringSocketHandler

public StringSocketHandler()
Method Detail

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.