|
||||||||||
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 IOHandler
IOHandler.afterAccept()
public void close()
close()
close
in interface IOHandler
IOHandler.close()
public void connectClient(java.util.Map parameters, int timeout) throws IndyIOException
IOHandler.connectClient(Map,int)
.connectClient
in interface IOHandler
parameters
- 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 IOHandler
IOHandler.open()
public int read(byte[] b) throws IndyIOException
read
in interface IOHandler
b
- 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 IOHandler
b
- 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 IOHandler
b
- An array of bytes to read the data intooff
- The offset at which to start writing to b
len
- 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 IOHandler
IndyIOException
- 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 IOHandler
timeout
- 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
IOHandler
getReadTimeOut
in interface IOHandler
public void setReadTimeOut(int newTimeout) throws IndyIOException
IOHandler
setReadTimeOut
in interface IOHandler
newTimeout
- The new timeout value to usejava.lang.IllegalArgumentException
- If the newTimeout
is < 0public int getMaximumLineLength()
getMaximumLineLength
in interface IOHandler
IOHandler
public void setMaximumLineLength(int newMaximumLineLength)
IOHandler
setMaximumLineLength
in interface IOHandler
newMaximumLineLength
- The new maximum line lengthjava.lang.IllegalArgumentException
- if newMaximumLineLength
is < 0public void addIOHandlerListener(IOHandlerListener l)
IOHandlerListener
to receive events from this IOHandler
addIOHandlerListener
in interface IOHandler
l
- The IOHandlerListener
removeIOHandlerListener(IOHandlerListener)
public void removeIOHandlerListener(IOHandlerListener l)
IOHandlerListener
from the listener list.removeIOHandlerListener
in interface IOHandler
l
- The IOHandlerListener
addIOHandlerListener(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 |