com.objexcel.irc
Class DCCConnection

java.lang.Object
  |
  +--java.awt.Component
        |
        +--com.objexcel.irc.DCCConnection

public final class DCCConnection
extends java.awt.Component
implements Sender.OutputStreamLocator

dccconnection creates and manages a socket connection for a dcc. It handles file transfers as well as chats.

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Method Summary
static DCCConnection acceptDCCChat(IRCController controller, long address, int port, boolean bStartNow, java.lang.String localHost)
          create a dcc connection to accept a chat
static DCCConnection acceptDCCSend(long address, int port, java.io.File file, boolean bStartNow, java.lang.String localHost)
          create a dcc connection to accept a sent file
 void addDCCEventListener(DCCEventListener l)
           
 void connect()
           
 void disconnect()
           
 long getAddress()
           
 java.io.File getFile()
          file being sent/received
 java.net.InetAddress getLocalHost()
           
 java.io.OutputStream getOutputStream()
          OuputStreamLocator interface
 int getPort()
           
 Sender getSender()
           
 boolean isConnected()
          true if there is a connection
 void postMessage(java.lang.String err, java.lang.Throwable e)
           
 void processEvent(java.awt.AWTEvent aevent)
           
 void removeDCCEventListener(DCCEventListener l)
           
 void setFile(java.io.File f)
           
static DCCConnection startDCCChat(IRCController controller, java.lang.String localHost)
          create a dcc connection to offer a chat
static DCCConnection startDCCSend(java.io.File f, java.lang.String localHost)
          create a dcc connection to offer a file
 boolean wasStarted()
          true if the connection was ever attempted (it may not have been accepted, it may have been cancelled but was it started?
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

acceptDCCChat

public static DCCConnection acceptDCCChat(IRCController controller,
                                          long address,
                                          int port,
                                          boolean bStartNow,
                                          java.lang.String localHost)
create a dcc connection to accept a chat
Parameters:
localHost - can be null

acceptDCCSend

public static DCCConnection acceptDCCSend(long address,
                                          int port,
                                          java.io.File file,
                                          boolean bStartNow,
                                          java.lang.String localHost)
create a dcc connection to accept a sent file
Parameters:
localHost - can be null

startDCCChat

public static DCCConnection startDCCChat(IRCController controller,
                                         java.lang.String localHost)
create a dcc connection to offer a chat
Parameters:
localHost - can be null

startDCCSend

public static DCCConnection startDCCSend(java.io.File f,
                                         java.lang.String localHost)
create a dcc connection to offer a file
Parameters:
localHost - can be null

getSender

public Sender getSender()

getPort

public int getPort()

getAddress

public long getAddress()

connect

public void connect()

disconnect

public void disconnect()

getFile

public java.io.File getFile()
file being sent/received

setFile

public void setFile(java.io.File f)

isConnected

public boolean isConnected()
true if there is a connection

wasStarted

public boolean wasStarted()
true if the connection was ever attempted (it may not have been accepted, it may have been cancelled but was it started?

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
OuputStreamLocator interface
Specified by:
getOutputStream in interface Sender.OutputStreamLocator

postMessage

public void postMessage(java.lang.String err,
                        java.lang.Throwable e)

processEvent

public void processEvent(java.awt.AWTEvent aevent)

addDCCEventListener

public void addDCCEventListener(DCCEventListener l)

removeDCCEventListener

public void removeDCCEventListener(DCCEventListener l)

getLocalHost

public java.net.InetAddress getLocalHost()