net.jackofalltrades.irc.dcc
Class BaseDccConnection

java.lang.Object
  extended bynet.jackofalltrades.irc.BaseConnection
      extended bynet.jackofalltrades.irc.dcc.BaseDccConnection
All Implemented Interfaces:
DccDataListener, java.util.EventListener, java.lang.Runnable
Direct Known Subclasses:
DccBinaryConnection, DccTextConnection

public abstract class BaseDccConnection
extends BaseConnection
implements DccDataListener

Provides event handler functionality for DCC connections, and provides facilites to write output to the underlying Socket.

Since:
0.5-alpha
Version:
$Revision: 1.5 $ $Date: 2003/08/03 21:01:36 $
Author:
Bradley M. Handy

Field Summary
 
Fields inherited from class net.jackofalltrades.irc.BaseConnection
DEFAULT_BUFFER_SIZE, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_WRITE_TIMEOUT, MAX_PORT, MIN_PORT
 
Constructor Summary
BaseDccConnection()
          Creates a new BaseDccConnection.
BaseDccConnection(java.net.InetAddress remoteHost, int port)
          Creates a new BaseDccConnection to connect to the specified remote host.
BaseDccConnection(java.net.Socket socket)
          Creates a new BaseDccConnection connected on the specified java.net.Socket.
BaseDccConnection(java.lang.String remoteHost, int port)
          Creates a new BaseDccConnection to connect to the specified remote host.
 
Method Summary
 void addDccDataListener(IrcCommandListener l)
          Registers an IrcCommandListener for all commands.
 void dataPrepared(DccDataEvent event)
          Writes data to the output stream.
 void dataReceived(DccDataEvent event)
          Does nothing.
protected  void fireDataReceived(DccDataEvent event)
           
 void removeDccDataListener(IrcCommandListener l)
          Removes an IrcCommandListener from the list of registered listeners for all commands.
protected  void wrapOutput(java.io.OutputStream output)
          Wraps the OutputStream in a java.io.Writer.
 
Methods inherited from class net.jackofalltrades.irc.BaseConnection
addConnectionListener, addEventListener, connect, disconnect, getBufferSize, getConnectionTimeout, getEventListeners, getLastException, getPortNumber, getReadWriteTimeout, getRemoteHost, isConnected, processInput, removeConnectionListener, removeEventListener, run, setBufferSize, setConnectionTimeout, setLastException, setPortNumber, setReadWriteTimeout, setRemoteHost, wrapInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseDccConnection

public BaseDccConnection()
Creates a new BaseDccConnection.


BaseDccConnection

public BaseDccConnection(java.net.InetAddress remoteHost,
                         int port)
Creates a new BaseDccConnection to connect to the specified remote host.

Parameters:
remoteHost - the java.net.InetAddress of the remote host.
port - the port number on the remote host.
Throws:
java.lang.IllegalArgumentException - if remoteHost is null or if port is not in the range 1 - 65535.

BaseDccConnection

public BaseDccConnection(java.lang.String remoteHost,
                         int port)
                  throws java.net.UnknownHostException
Creates a new BaseDccConnection to connect to the specified remote host.

Parameters:
remoteHost - the name of the remote host.
port - the port number on the server.
Throws:
java.net.UnknownHostException - if the remoteHost cannot be resolved.
java.lang.IllegalArgumentException - if the remoteHost

BaseDccConnection

public BaseDccConnection(java.net.Socket socket)
Creates a new BaseDccConnection connected on the specified java.net.Socket.

Parameters:
socket - the Socket connected to the remote host.
Method Detail

dataPrepared

public void dataPrepared(DccDataEvent event)
Writes data to the output stream.

Specified by:
dataPrepared in interface DccDataListener
Parameters:
event - the event fired by a DCC data generating component.

wrapOutput

protected void wrapOutput(java.io.OutputStream output)
Wraps the OutputStream in a java.io.Writer.

Specified by:
wrapOutput in class BaseConnection
Parameters:
output - the OutputStream from the underlying java.net.Socket.

dataReceived

public void dataReceived(DccDataEvent event)
Does nothing.

Specified by:
dataReceived in interface DccDataListener

fireDataReceived

protected void fireDataReceived(DccDataEvent event)

addDccDataListener

public void addDccDataListener(IrcCommandListener l)
Registers an IrcCommandListener for all commands.

Parameters:
l - the new registered listener.

removeDccDataListener

public void removeDccDataListener(IrcCommandListener l)
Removes an IrcCommandListener from the list of registered listeners for all commands.

Parameters:
l - the listener to remove.


Copyright © 2002-2003 Jack-of-all-trades Programming Services. All Rights Reserved.