DccFileTransfer (PircBot 1.5.0 - Java IRC API Bot Framework)
Keywords: org.jibble.pircbot.DccFileTransfer class

Package | Class | Use | Tree | Deprecated | Index | Help
| PircBot Java IRC Bot
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jibble.pircbot
Class DccFileTransfer

    java.lang.Object
      org.jibble.pircbot.DccFileTransfer

public class DccFileTransfer
extends Object

This class is used to administer a DCC file transfer.

Since:
  1.2.0
Version:
  1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
Author:
  Paul James Mutton, http://www.jibble.org/

Field Summary
`static int` | `BUFFER_SIZE` The default buffer size to use when sending and receiving files.

Method Summary
`void` | `close()` Stops the DCC file transfer by closing the connection.
`File` | `getFile()` Returns the suggested file to be used for this transfer.
`String` | `getHostname()` Returns the hostname of the file sender.
`String` | `getLogin()` Returns the login of the file sender.
`String` | `getNick()` Returns the nick of the other user taking part in this file transfer.
`long` | `getNumericalAddress()` Returns the address of the sender as a long.
`long` | `getPacketDelay()` returns the delay time between each packet that is send or received.
`int` | `getPort()` Returns the port number to be used when making the connection.
`long` | `getProgress()` Returns the progress (in bytes) of the current file transfer.
`double` | `getProgressPercentage()` Returns the progress of the file transfer as a percentage.
`long` | `getSize()` Returns the size (in bytes) of the file being transfered.
`long` | `getTransferRate()` Returns the rate of data transfer in bytes per second.
`boolean` | `isIncoming()` Returns true if the file transfer is incoming (somebody is sending the file to us).
`boolean` | `isOutgoing()` Returns true if the file transfer is outgoing (we are sending the file to someone).
`void` | `receive(File file, boolean resume)` Receives a DccFileTransfer and writes it to the specified file.
`void` | `setPacketDelay(long millis)` Sets the delay time between sending or receiving each packet.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BUFFER_SIZE

    public static final int BUFFER_SIZE

  The default buffer size to use when sending and receiving files.

  See Also:
    Constant Field Values

Method Detail

### receive

    public void receive(File file,
                        boolean resume)

  Receives a DccFileTransfer and writes it to the specified file. Resuming allows a partial download to be continue from the end of the current file contents.

  Parameters:
    `file` - The file to write to.
    `resume` - True if you wish to try and resume the download instead of overwriting an existing file.

### getNick

    public String getNick()

  Returns the nick of the other user taking part in this file transfer.

  Returns:
    the nick of the other user.

### getLogin

    public String getLogin()

  Returns the login of the file sender.

  Returns:
    the login of the file sender. null if we are sending.

### getHostname

    public String getHostname()

  Returns the hostname of the file sender.

  Returns:
    the hostname of the file sender. null if we are sending.

### getFile

    public File getFile()

  Returns the suggested file to be used for this transfer.

  Returns:
    the suggested file to be used.

### getPort

    public int getPort()

  Returns the port number to be used when making the connection.

  Returns:
    the port number.

### isIncoming

    public boolean isIncoming()

  Returns true if the file transfer is incoming (somebody is sending the file to us).

  Returns:
    true if the file transfer is incoming.

### isOutgoing

    public boolean isOutgoing()

  Returns true if the file transfer is outgoing (we are sending the file to someone).

  Returns:
    true if the file transfer is outgoing.

### setPacketDelay

    public void setPacketDelay(long millis)

  Sets the delay time between sending or receiving each packet. Default is 0. This is useful for throttling the speed of file transfers to maintain a good quality of service for other things on the machine or network.

  Parameters:
    `millis` - The number of milliseconds to wait between packets.

### getPacketDelay

    public long getPacketDelay()

  returns the delay time between each packet that is send or received.

  Returns:
    the delay between each packet.

### getSize

    public long getSize()

  Returns the size (in bytes) of the file being transfered.

  Returns:
    the size of the file. Returns -1 if the sender did not specify this value.

### getProgress

    public long getProgress()

  Returns the progress (in bytes) of the current file transfer. When resuming, this represents the total number of bytes in the file, which may be greater than the amount of bytes resumed in just this transfer.

  Returns:
    the progress of the transfer.

### getProgressPercentage

    public double getProgressPercentage()

  Returns the progress of the file transfer as a percentage. Note that this should never be negative, but could become greater than 100% if you attempt to resume a larger file onto a partially downloaded file that was smaller.

  Returns:
    the progress of the transfer as a percentage.

### close

    public void close()

  Stops the DCC file transfer by closing the connection.

### getTransferRate

    public long getTransferRate()

  Returns the rate of data transfer in bytes per second. This value is an estimate based on the number of bytes transfered since the connection was established.

  Returns:
    data transfer rate in bytes per second.

### getNumericalAddress

    public long getNumericalAddress()

  Returns the address of the sender as a long.

  Returns:
    the address of the sender as a long.

Package | Class | Use | Tree | Deprecated | Index | Help
| PircBot Java IRC Bot
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD