mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-21 01:57:57 +01:00
SMACK-263 Applied patch for setting file info for transfer
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_2_0@12854 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
c96be693dc
commit
3b47f94b35
2 changed files with 22 additions and 19 deletions
|
@ -130,10 +130,10 @@ public abstract class FileTransfer {
|
|||
|
||||
/**
|
||||
* Returns true if the transfer has been cancelled, if it has stopped because
|
||||
* of a an error, or the transfer completed succesfully.
|
||||
* of a an error, or the transfer completed successfully.
|
||||
*
|
||||
* @return Returns true if the transfer has been cancelled, if it has stopped
|
||||
* because of a an error, or the transfer completed succesfully.
|
||||
* because of a an error, or the transfer completed successfully.
|
||||
*/
|
||||
public boolean isDone() {
|
||||
return status == Status.cancelled || status == Status.error
|
||||
|
@ -141,9 +141,9 @@ public abstract class FileTransfer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retuns the current status of the file transfer.
|
||||
* Returns the current status of the file transfer.
|
||||
*
|
||||
* @return Retuns the current status of the file transfer.
|
||||
* @return Returns the current status of the file transfer.
|
||||
*/
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
|
@ -158,7 +158,7 @@ public abstract class FileTransfer {
|
|||
* during the transfer, the type of error can be retrieved through this
|
||||
* method.
|
||||
*
|
||||
* @return Returns the type of error that occured if one has occured.
|
||||
* @return Returns the type of error that occurred if one has occurred.
|
||||
*/
|
||||
public Error getError() {
|
||||
return error;
|
||||
|
@ -166,9 +166,9 @@ public abstract class FileTransfer {
|
|||
|
||||
/**
|
||||
* If an exception occurs asynchronously it will be stored for later
|
||||
* retrival. If there is an error there maybe an exception set.
|
||||
* retrieval. If there is an error there maybe an exception set.
|
||||
*
|
||||
* @return The exception that occured or null if there was no exception.
|
||||
* @return The exception that occurred or null if there was no exception.
|
||||
* @see #getError()
|
||||
*/
|
||||
public Exception getException() {
|
||||
|
@ -246,7 +246,7 @@ public abstract class FileTransfer {
|
|||
public enum Status {
|
||||
|
||||
/**
|
||||
* An error occured during the transfer.
|
||||
* An error occurred during the transfer.
|
||||
*
|
||||
* @see FileTransfer#getError()
|
||||
*/
|
||||
|
@ -259,7 +259,7 @@ public abstract class FileTransfer {
|
|||
|
||||
/**
|
||||
* The file transfer is being negotiated with the peer. The party
|
||||
* recieving the file has the option to accept or refuse a file transfer
|
||||
* Receiving the file has the option to accept or refuse a file transfer
|
||||
* request. If they accept, then the process of stream negotiation will
|
||||
* begin. If they refuse the file will not be transfered.
|
||||
*
|
||||
|
@ -283,7 +283,7 @@ public abstract class FileTransfer {
|
|||
negotiating_stream("Negotiating Stream"),
|
||||
|
||||
/**
|
||||
* After the stream negotitation has completed the intermediate state
|
||||
* After the stream negotiation has completed the intermediate state
|
||||
* between the time when the negotiation is finished and the actual
|
||||
* transfer begins.
|
||||
*/
|
||||
|
@ -302,7 +302,7 @@ public abstract class FileTransfer {
|
|||
complete("Complete"),
|
||||
|
||||
/**
|
||||
* The file transfer was canceled
|
||||
* The file transfer was cancelled
|
||||
*/
|
||||
cancelled("Cancelled");
|
||||
|
||||
|
@ -348,12 +348,12 @@ public abstract class FileTransfer {
|
|||
no_response("The remote user did not respond or the connection timed out."),
|
||||
|
||||
/**
|
||||
* An error occured over the socket connected to send the file.
|
||||
* An error occurred over the socket connected to send the file.
|
||||
*/
|
||||
connection("An error occured over the socket connected to send the file."),
|
||||
|
||||
/**
|
||||
* An error occured while sending or recieving the file
|
||||
* An error occurred while sending or receiving the file
|
||||
*/
|
||||
stream("An error occured while sending or recieving the file.");
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
|
||||
/**
|
||||
* Returns the output stream connected to the peer to transfer the file. It
|
||||
* is only available after it has been succesfully negotiated by the
|
||||
* is only available after it has been successfully negotiated by the
|
||||
* {@link StreamNegotiator}.
|
||||
*
|
||||
* @return Returns the output stream connected to the peer to transfer the
|
||||
|
@ -120,6 +120,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
+ " been attempted on this file transfer");
|
||||
}
|
||||
try {
|
||||
setFileInfo(fileName, fileSize);
|
||||
this.outputStream = negotiateStream(fileName, fileSize, description);
|
||||
} catch (XMPPException e) {
|
||||
handleXMPPException(e);
|
||||
|
@ -159,6 +160,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
"The negotation process has already"
|
||||
+ " been attempted for this file transfer");
|
||||
}
|
||||
setFileInfo(fileName, fileSize);
|
||||
this.callback = progress;
|
||||
transferThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -184,7 +186,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
|
||||
/**
|
||||
* This method handles the stream negotiation process and transmits the file
|
||||
* to the remote user. It returns immediatly and the progress of the file
|
||||
* to the remote user. It returns immediately and the progress of the file
|
||||
* transfer can be monitored through several methods:
|
||||
*
|
||||
* <UL>
|
||||
|
@ -257,7 +259,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
|
||||
/**
|
||||
* This method handles the stream negotiation process and transmits the file
|
||||
* to the remote user. It returns immediatly and the progress of the file
|
||||
* to the remote user. It returns immediately and the progress of the file
|
||||
* transfer can be monitored through several methods:
|
||||
*
|
||||
* <UL>
|
||||
|
@ -274,6 +276,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
public synchronized void sendStream(final InputStream in, final String fileName, final long fileSize, final String description){
|
||||
checkTransferThread();
|
||||
|
||||
setFileInfo(fileName, fileSize);
|
||||
transferThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
//Create packet filter
|
||||
|
@ -339,7 +342,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
* -1 if the file transfer has not started.
|
||||
* <p>
|
||||
* Note: This method is only useful when the {@link #sendFile(File, String)}
|
||||
* method is called, as it is the only method that actualy transmits the
|
||||
* method is called, as it is the only method that actually transmits the
|
||||
* file.
|
||||
*
|
||||
* @return Returns the amount of bytes that have been sent for the file
|
||||
|
@ -410,7 +413,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
}
|
||||
|
||||
/**
|
||||
* A callback class to retrive the status of an outgoing transfer
|
||||
* A callback class to retrieve the status of an outgoing transfer
|
||||
* negotiation process.
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
|
@ -438,7 +441,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
/**
|
||||
* Called when an exception occurs during the negotiation progress.
|
||||
*
|
||||
* @param e the exception that occured.
|
||||
* @param e the exception that occurred.
|
||||
*/
|
||||
void errorEstablishingStream(Exception e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue