com.sshtools.terminal
Class IOStreamConnector

java.lang.Object
  extended by com.sshtools.terminal.IOStreamConnector

public class IOStreamConnector
extends java.lang.Object

Writes all data received from an InputStream into an OutputStream.

Author:
Lee David Painter

Nested Class Summary
static interface IOStreamConnector.IOStreamConnectorListener
          An event listener interface so recieving notifications of when data is transferred by the connector.
 
Field Summary
static int DEFAULT_BUFFER_SIZE
           
protected  java.util.Vector listenerList
           
 
Constructor Summary
IOStreamConnector()
          Creates a new IOStreamConnector object.
IOStreamConnector(java.io.InputStream in, java.io.OutputStream out)
          Creates a connector and start transfering data.
 
Method Summary
 void addListener(IOStreamConnector.IOStreamConnectorListener l)
          Add an event listener.
 void close()
          Stop transferring data and close the streams if required.
 void connect(java.io.InputStream in, java.io.OutputStream out)
          Initialize the connector and start transferring data.
 long getBytes()
          Get the number of bytes transferred.
 java.io.IOException getLastError()
          Get the last error received.
 boolean isClosed()
          Determine the current state of the connector.
 void removeListener(IOStreamConnector.IOStreamConnectorListener l)
          Remove an event listener.
 void setBufferSize(int numbytes)
          Set the buffer size used when transfering data.
 void setCloseInput(boolean closeInput)
          Set the close state of the InputStream.
 void setCloseOutput(boolean closeOutput)
          Set the close state of the OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

listenerList

protected java.util.Vector listenerList
Constructor Detail

IOStreamConnector

public IOStreamConnector()
Creates a new IOStreamConnector object.


IOStreamConnector

public IOStreamConnector(java.io.InputStream in,
                         java.io.OutputStream out)
Creates a connector and start transfering data.

Parameters:
in -
out -
Method Detail

close

public void close()
Stop transferring data and close the streams if required.

Throws:
java.io.IOException

getLastError

public java.io.IOException getLastError()
Get the last error received.

Returns:

setCloseInput

public void setCloseInput(boolean closeInput)
Set the close state of the InputStream. If set to true the connector will close the InputStream when the connector is closed.

Parameters:
closeInput -

setCloseOutput

public void setCloseOutput(boolean closeOutput)
Set the close state of the OutputStream. If set to true the connector will close the OutputStream when the connector is closed, or when the InputStream returns EOF.

Parameters:
closeOutput -

setBufferSize

public void setBufferSize(int numbytes)
Set the buffer size used when transfering data.

Parameters:
numbytes -

connect

public void connect(java.io.InputStream in,
                    java.io.OutputStream out)
Initialize the connector and start transferring data.

Parameters:
in -
out -

getBytes

public long getBytes()
Get the number of bytes transferred.

Returns:

isClosed

public boolean isClosed()
Determine the current state of the connector.

Returns:

addListener

public void addListener(IOStreamConnector.IOStreamConnectorListener l)
Add an event listener.

Parameters:
l -

removeListener

public void removeListener(IOStreamConnector.IOStreamConnectorListener l)
Remove an event listener.

Parameters:
l -


Copyright © 2003-2004 3SP LTD. All Rights Reserved.