public abstract class FileTransfer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileTransfer.Error |
static class |
FileTransfer.Status
A class to represent the current status of the file transfer.
|
Modifier and Type | Field and Description |
---|---|
protected long |
amountWritten |
protected FileTransferNegotiator |
negotiator |
protected java.lang.String |
streamID |
Modifier | Constructor and Description |
---|---|
protected |
FileTransfer(java.lang.String peer,
java.lang.String streamID,
FileTransferNegotiator negotiator) |
Modifier and Type | Method and Description |
---|---|
abstract void |
cancel()
Cancels the file transfer.
|
long |
getAmountWritten()
Return the length of bytes written out to the stream.
|
FileTransfer.Error |
getError()
When
getStatus() returns that there was an FileTransfer.Status.ERROR
during the transfer, the type of error can be retrieved through this
method. |
java.lang.Exception |
getException()
If an exception occurs asynchronously it will be stored for later
retrival.
|
java.lang.String |
getFileName()
Returns the name of the file being transfered.
|
java.lang.String |
getFilePath()
Returns the local path of the file.
|
long |
getFileSize()
Returns the size of the file being transfered.
|
java.lang.String |
getPeer()
Returns the JID of the peer for this file transfer.
|
double |
getProgress()
Returns the progress of the file transfer as a number between 0 and 1.
|
FileTransfer.Status |
getStatus()
Retuns the current status of the file transfer.
|
boolean |
isDone()
Returns true if the transfer has been cancled, if it has stopped because
of a an error, or the transfer completed succesfully.
|
protected void |
setError(FileTransfer.Error type) |
protected void |
setException(java.lang.Exception exception) |
protected void |
setFileInfo(java.lang.String fileName,
long fileSize) |
protected void |
setFileInfo(java.lang.String path,
java.lang.String fileName,
long fileSize) |
protected void |
setStatus(FileTransfer.Status status) |
protected boolean |
updateStatus(FileTransfer.Status oldStatus,
FileTransfer.Status newStatus) |
protected void |
writeToStream(java.io.InputStream in,
java.io.OutputStream out) |
protected FileTransferNegotiator negotiator
protected java.lang.String streamID
protected long amountWritten
protected FileTransfer(java.lang.String peer, java.lang.String streamID, FileTransferNegotiator negotiator)
protected void setFileInfo(java.lang.String fileName, long fileSize)
protected void setFileInfo(java.lang.String path, java.lang.String fileName, long fileSize)
public long getFileSize()
public java.lang.String getFileName()
public java.lang.String getFilePath()
public java.lang.String getPeer()
public double getProgress()
public boolean isDone()
public FileTransfer.Status getStatus()
protected void setError(FileTransfer.Error type)
public FileTransfer.Error getError()
getStatus()
returns that there was an FileTransfer.Status.ERROR
during the transfer, the type of error can be retrieved through this
method.public java.lang.Exception getException()
getError()
public abstract void cancel()
protected void setException(java.lang.Exception exception)
protected final void setStatus(FileTransfer.Status status)
protected final boolean updateStatus(FileTransfer.Status oldStatus, FileTransfer.Status newStatus)
protected void writeToStream(java.io.InputStream in, java.io.OutputStream out) throws XMPPException
XMPPException
public long getAmountWritten()
Copyright © 2003 Jive Software.