irc.dcc
Class DCCFile

java.lang.Object
  |
  +--irc.IRCObject
        |
        +--irc.Source
              |
              +--irc.dcc.DCCFile

public class DCCFile
extends Source

The DCCFile, used for file transferts.


Field Summary
 
Fields inherited from class irc.Source
_in, _server
 
Fields inherited from class irc.IRCObject
_ircConfiguration
 
Constructor Summary
DCCFile(IRCConfiguration config, java.io.File f, DCCFileHandler handler)
          Create a new DCCFile.
 
Method Summary
 void addDCCFileListener(DCCFileListener lis)
          Add a listener.
 void byteReceived(byte b)
          Write a new byte in the destination file.
 void fileReceived()
          Notify this dcc file the file reception is terminated.
 void fileReceiveFailed()
          Notify this dcc file the file reception has failed.
 void fileSent()
          Notify this file the sending is terminated.
 void fileSentFailed()
          Notify this file the sending has failed.
 java.lang.String getName()
          Get this source name.
 int getSize()
          Get the file size.
 java.lang.String getType()
          Get this source type.
 boolean isDownloading()
          Return true if the transfert is a download transfert.
 boolean isUploading()
          Return true if the transfert is an upload transfert.
 void leave()
          Request to leave (close) this source.
 void prepareReceive(int size)
          Prepare to receive file.
 void prepareSend()
          Prepare to send the file.
 byte readByte()
          Read the next byte while sending.
 void removeDCCFileListener(DCCFileListener lis)
          Remove a listener.
 boolean talkable()
          Test wether this source can accept messages from user.
 
Methods inherited from class irc.Source
action, activate, addSourceListener, clear, getInterpretor, getServer, isActive, mayDefault, messageReceived, noticeReceived, release, removeSourceListener, report, sendString, setCTCPFilter, setInterpretor
 
Methods inherited from class irc.IRCObject
getColor, getIRCConfiguration, getText, getText, getText, getText, getTimeStamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DCCFile

public DCCFile(IRCConfiguration config,
               java.io.File f,
               DCCFileHandler handler)
Create a new DCCFile.

Parameters:
f - the file to transfert.
handler - the file handler.
Method Detail

addDCCFileListener

public void addDCCFileListener(DCCFileListener lis)
Add a listener.

Parameters:
lis - listener to add.

removeDCCFileListener

public void removeDCCFileListener(DCCFileListener lis)
Remove a listener.

Parameters:
lis - listener to remove.

prepareSend

public void prepareSend()
Prepare to send the file.


readByte

public byte readByte()
Read the next byte while sending.

Returns:
next byte, or -1 if end of file reached.

getSize

public int getSize()
Get the file size.

Returns:
the file size, in byte.

isUploading

public boolean isUploading()
Return true if the transfert is an upload transfert.

Returns:
true if uplading, false otherwise.

isDownloading

public boolean isDownloading()
Return true if the transfert is a download transfert.

Returns:
true if downloading, false otherwise.

fileSent

public void fileSent()
Notify this file the sending is terminated.


fileSentFailed

public void fileSentFailed()
Notify this file the sending has failed.


prepareReceive

public void prepareReceive(int size)
Prepare to receive file.

Parameters:
size - the file size.

byteReceived

public void byteReceived(byte b)
Write a new byte in the destination file.

Parameters:
b - the new received byte.

fileReceived

public void fileReceived()
Notify this dcc file the file reception is terminated.


fileReceiveFailed

public void fileReceiveFailed()
Notify this dcc file the file reception has failed.


getName

public java.lang.String getName()
Description copied from class: Source
Get this source name.

Specified by:
getName in class Source
Returns:
source name.

leave

public void leave()
Description copied from class: Source
Request to leave (close) this source.

Specified by:
leave in class Source

talkable

public boolean talkable()
Description copied from class: Source
Test wether this source can accept messages from user.

Specified by:
talkable in class Source
Returns:
true if this source accepts user input, false otherwise.

getType

public java.lang.String getType()
Description copied from class: Source
Get this source type.

Specified by:
getType in class Source
Returns:
source type.