|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.indy.io.AbstractIOHandler
A skeleton implementation of IOHandler. This provides no-ops for
the non base IO methods of IOHandler, property accessors and mutators and
listener management for concrete subclasses.
| Field Summary | |
protected javax.swing.event.EventListenerList |
listenerList
Holds a list of interested listeners |
protected int |
maximumLineLength
The maximum line length to be used for read line operations Initially set to the Indy default value |
protected int |
readTimeOut
The timeout to be used for read operations on this IOHandler. |
| Constructor Summary | |
AbstractIOHandler()
|
|
| Method Summary | |
void |
addIOHandlerListener(IOHandlerListener l)
Add a IOHandlerListener to receive events from this IOHandler |
void |
afterAccept()
Provides a no-op implementation of AfterAccept() |
void |
close()
Provides a a no-op implementation of close() |
void |
connectClient(java.util.Map parameters,
int timeout)
A no-op implementation of IOHandler.connectClient(Map,int). |
protected void |
doOnConnect()
Fires an onConnect event to all registered listeners |
protected void |
doOnDisconnect()
Fires an onDisconnect event to all registered listeners |
protected void |
doStatus(Status s,
java.lang.Object[] args)
Fires an OnStatus event to all registered listeners |
int |
getMaximumLineLength()
Gets the maximum line length to be used for read line operations |
int |
getReadTimeOut()
Returns the current timeout for read operations on this IOHandler |
void |
open()
Provides a no-op imlpementaion of open() |
int |
read(byte[] b)
Reads a sequence of bytes from the socket, using the readTimeOut property, if set, or the Indy default timeout otherwise. |
int |
read(byte[] b,
int len)
Reads a sequence of bytes from the socket, using the readTimeOut property, if set, or the Indy default timeout otherwise. |
int |
read(byte[] b,
int off,
int len)
Reads a sequence of bytes from the socket, using the readTimeOut property, if set, or the Indy default timeout otherwise. |
java.lang.String |
readLine()
Reads a line of text from the socket using the maximumLineLength and readTimeOut
properties. |
java.lang.String |
readLine(int timeout,
int maxLineLength)
Reads a line of data from the socket |
void |
removeIOHandlerListener(IOHandlerListener l)
Remove a IOHandlerListener from the listener list. |
void |
setMaximumLineLength(int newMaximumLineLength)
Sets the maximum line length to be acceped by this IOHandler |
void |
setReadTimeOut(int newTimeout)
Set the timeout for read operations on this IOHandler |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.indy.io.IOHandler |
available, clearBuffer, currentReadBuffer, flush, isConnected, read, read, read, readLine, write, write, write |
| Field Detail |
protected int readTimeOut
IOHandler.
Initially set to the Indy default valueIndyUtilities.getDefaultTimeout()protected int maximumLineLength
IndyUtilities.getDefaultMaxLineLength()protected javax.swing.event.EventListenerList listenerList
| Constructor Detail |
public AbstractIOHandler()
| Method Detail |
public void afterAccept()
AfterAccept()afterAccept in interface IOHandlerIOHandler.afterAccept()public void close()
close()close in interface IOHandlerIOHandler.close()
public void connectClient(java.util.Map parameters,
int timeout)
throws IndyIOException
IOHandler.connectClient(Map,int).connectClient in interface IOHandlerparameters - The parameters to use for connectiontimeout - The timeout to use for connectionIndyIOException - If an IO error ocurrsIOHandler.connectClient(Map,int)public void open()
open()open in interface IOHandlerIOHandler.open()
public int read(byte[] b)
throws IndyIOException
read in interface IOHandlerb - An array of bytes to read the data intoIndyIOException - If an IO error occurs.PeerDisconnectedException - if the remote machine has disconnectedReadTimedOutException - if the read opertaion timed outNotConnectedException - if the socket is not connectedIOHandler.read(byte[],int,int,int)
public int read(byte[] b,
int len)
throws IndyIOException,
ReadTimedOutException
read in interface IOHandlerb - An array of bytes to read the data intolen - The amount of data to readIndyIOException - If an IO error occurs.PeerDisconnectedException - if the remote machine has disconnectedReadTimedOutException - if the read opertaion timed outNotConnectedException - if the socket is not connectedIOHandler.read(byte[],int,int,int)
public int read(byte[] b,
int off,
int len)
throws IndyIOException,
ReadTimedOutException
read in interface IOHandlerb - An array of bytes to read the data intooff - The offset at which to start writing to blen - The amount of data to readIndyIOException - If an IO error occurs.PeerDisconnectedException - if the remote machine has disconnectedReadTimedOutException - if the read opertaion timed outNotConnectedException - if the socket is not connectedIOHandler.read(byte[],int,int,int)
public java.lang.String readLine()
throws IndyIOException
maximumLineLength and readTimeOut
properties.readLine in interface IOHandlerIndyIOException - if an IO error occursPeerDisconnectedException - if the remote machine disconnects normallyReadTimedOutException - if the operation times outMaxLineLengthExceededException - if the maximum line length is exceeded before a line break is foundgetReadTimeOut(),
setReadTimeOut(int,int),
getMaximumLineLength(),
setMaximumLineLength(int)
public java.lang.String readLine(int timeout,
int maxLineLength)
throws IndyIOException,
PeerDisconnectedException,
ReadTimedOutException,
MaxLineLengthExceededException
readLine in interface IOHandlertimeout - The timeout to use for this operationmaxLineLength - The maxiumum line length to acceptIndyIOException - if an IO error occursPeerDisconnectedException - if the remote machine disconnects normallyReadTimedOutException - if the operation times outMaxLineLengthExceededException - if the maximum line length is exceeded before a line break is foundIOHandler.readLine(int,int,String)
public int getReadTimeOut()
throws IndyIOException
IOHandlergetReadTimeOut in interface IOHandler
public void setReadTimeOut(int newTimeout)
throws IndyIOException
IOHandlersetReadTimeOut in interface IOHandlernewTimeout - The new timeout value to usejava.lang.IllegalArgumentException - If the newTimeout is < 0public int getMaximumLineLength()
getMaximumLineLength in interface IOHandlerIOHandler
public void setMaximumLineLength(int newMaximumLineLength)
IOHandlersetMaximumLineLength in interface IOHandlernewMaximumLineLength - The new maximum line lengthjava.lang.IllegalArgumentException - if newMaximumLineLength is < 0public void addIOHandlerListener(IOHandlerListener l)
IOHandlerListener to receive events from this IOHandleraddIOHandlerListener in interface IOHandlerl - The IOHandlerListenerremoveIOHandlerListener(IOHandlerListener)public void removeIOHandlerListener(IOHandlerListener l)
IOHandlerListener from the listener list.removeIOHandlerListener in interface IOHandlerl - The IOHandlerListeneraddIOHandlerListener(IOHandlerListener)protected void doOnDisconnect()
protected void doOnConnect()
protected void doStatus(Status s,
java.lang.Object[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||