本文整理汇总了Java中org.jivesoftware.smackx.filetransfer.FileTransfer.Status类的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Status类属于org.jivesoftware.smackx.filetransfer.FileTransfer包,在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseJabberStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
/**
* Parses the given Jabber status to a <tt>FileTransfer</tt> interface
* status.
*
* @param jabberStatus the Jabber status to parse
* @return the parsed status
*/
private static int parseJabberStatus(Status jabberStatus)
{
if (jabberStatus.equals(Status.complete))
return FileTransferStatusChangeEvent.COMPLETED;
else if (jabberStatus.equals(Status.cancelled))
return FileTransferStatusChangeEvent.CANCELED;
else if (jabberStatus.equals(Status.in_progress)
|| jabberStatus.equals(Status.negotiated))
return FileTransferStatusChangeEvent.IN_PROGRESS;
else if (jabberStatus.equals(Status.error))
return FileTransferStatusChangeEvent.FAILED;
else if (jabberStatus.equals(Status.refused))
return FileTransferStatusChangeEvent.REFUSED;
else if (jabberStatus.equals(Status.negotiating_transfer)
|| jabberStatus.equals(Status.negotiating_stream))
return FileTransferStatusChangeEvent.PREPARING;
else
// FileTransfer.Status.initial
return FileTransferStatusChangeEvent.WAITING;
}
示例2: TransferProgress
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public TransferProgress(TransferHandle handle, String fileName, long fileSize, Status newStatus, long amountWritten,
double progress, double transferRate, boolean outgoing) {
this.handle = handle;
this.fileName = fileName;
this.fileSize = fileSize;
this.newStatus = newStatus;
this.amountWritten = amountWritten;
this.progress = progress;
this.transferRate = transferRate;
this.outgoing = outgoing;
}
示例3: TransferData
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public TransferData(DeploymentID destinationID, DeploymentID listenerID, Status status, File file, long id,
long inactivityTimeout, int queuePosition, boolean receiveProgressUpdate, boolean isIncoming) {
this.destinationID = destinationID;
this.listenerID = listenerID;
this.status = status;
this.file = file;
this.id = id;
this.inactivityTimeout = inactivityTimeout;
this.queuePosition = queuePosition;
this.receiveProgressUpdate = receiveProgressUpdate;
this.isIncoming = isIncoming;
}
示例4: TransferDataMatcher
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public TransferDataMatcher(DeploymentID destinationID, DeploymentID listenerID, Status status, File file,
int queuePosition, boolean isIncoming) {
Collection<TransferData> transferDatas = new ArrayList<TransferData>();
transferDatas.add(new TransferData(destinationID, listenerID, status, file, 0, 0,
queuePosition, true, isIncoming));
this.transferDatas = transferDatas;
}
示例5: testGetAnsweredTransfer
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
@Test
public void testGetAnsweredTransfer() throws Exception {
module = deployMonitorUtil.createAndStartApplication(module);
SenderClass senderObject = new SenderClass();
module.deploy(SenderClass.OBJECT_NAME, senderObject);
DeploymentID destinationID = testGetFileTransfersUtil.getObjectDeployment(module, SenderClass.OBJECT_NAME).getDeploymentID();
DeploymentID listenerID = testGetFileTransfersUtil.getObjectDeployment(module, SenderClass.OBJECT_NAME).getDeploymentID();
OutgoingTransferHandle handle = new OutgoingTransferHandle(TRANSFER_FILE_LOG_NAME,
new File(TRANSFER_FILE), "", destinationID);
Message message = new Message(listenerID, destinationID, "sendFile");
message.addParameter(OutgoingTransferHandle.class, handle);
module.deliverMessage(message);
//expect send start transfer msg to FileTransfer
module.getServiceConsumer().consumeMessage();
module.getFileTransferConsumer().consumeMessage();
testGetFileTransfersUtil.getFileTransfers(module, destinationID,
listenerID, null, new File(TRANSFER_FILE), 0, false);
TestableFileTransferProcessor fileTransferProcessor = (TestableFileTransferProcessor) module.getFileTransferProcessor();
fileTransferProcessor.setOutgoingTransferStatus(handle, Status.initial);
testGetFileTransfersUtil.getFileTransfers(module, destinationID,
listenerID, Status.initial, new File(TRANSFER_FILE), 0, false);
}
示例6: getFileTransfers
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public void getFileTransfers(Module application, DeploymentID destinationID, DeploymentID listenerID, Status status, File file,
int queuePosition, boolean isIncoming) {
CommuneMonitor monitor = getMonitorController(application);
CommuneMonitorClient client = EasyMock.createMock(CommuneMonitorClient.class);
client.hereAreFileTransfers(TransferDataMatcher.eqMatcher(destinationID, listenerID, status, file, queuePosition, isIncoming));
EasyMock.replay(client);
monitor.getFileTransfers(client);
EasyMock.verify(client);
}
示例7: transDone
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public void transDone(Context context, String toUser, final Uri uri,
MsgType msgType, String path, final Status status);
示例8: sendFile
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
/**
* 发送文件
*
* @param connection
* @param user
* @param toUserName
* @param file
*/
public static void sendFile(final Context context,
final Connection connection, final String toUser, final Uri uri,
final String filePath, final MsgType msgType) {
new Thread() {
public void run() {
XMPPConnection.DEBUG_ENABLED = true;
// AccountManager accountManager;
try {
// accountManager = connection.getAccountManager();
Presence pre = connection.getRoster().getPresence(toUser);
if (pre.getType() != Presence.Type.unavailable) {
if (connection.isConnected()) {
Log.d(TAG, "connection con");
}
// 创建文件传输管理器
// ServiceDiscoveryManager sdm = ServiceDiscoveryManager
// .getInstanceFor(connection);
// if (sdm == null)
// sdm = new ServiceDiscoveryManager(connection);
FileTransferManager manager = new FileTransferManager(
connection);
// 创建输出的文件传输
OutgoingFileTransfer transfer = manager
.createOutgoingFileTransfer(pre.getFrom());
// 发送文件
transfer.sendFile(new File(filePath),
msgType.toString());
while (!transfer.isDone()) {
if (transfer.getStatus() == FileTransfer.Status.in_progress) {
// 可以调用transfer.getProgress();获得传输的进度
// Log.d(TAG,
// "send status:" + transfer.getStatus());
// Log.d(TAG,
// "send progress:"
// + transfer.getProgress());
if (mFileUploadListener != null) {
mFileUploadListener.transProgress(context,
uri, filePath,
transfer.getProgress());
}
}
}
// YiLog.getInstance().i("send file error: %s",
// transfer.);
Log.d(TAG, "send status 1 " + transfer.getStatus());
if (transfer.isDone()) {
if (mFileUploadListener != null) {
mFileUploadListener.transDone(context, toUser,
uri, msgType, filePath,
transfer.getStatus());
}
}
}
} catch (Exception e) {
Log.d(TAG, "send exception");
if (mFileUploadListener != null) {
mFileUploadListener.transDone(context, toUser, uri,
msgType, filePath, Status.error);
}
}
}
}.start();
}
示例9: getNewStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public Status getNewStatus() {
return this.newStatus;
}
示例10: getCurrentStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public Status getCurrentStatus() {
return this.currentStatus;
}
示例11: setCurrentStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public void setCurrentStatus(Status currentStatus) {
this.currentStatus = currentStatus;
}
示例12: setOutgoingTransferStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public void setOutgoingTransferStatus(OutgoingTransferHandle handle, Status newStatus) {
OutgoingTransfer transfer = getTransferManager().getOutgoingManager().getTransfer(handle);
transfer.setCurrentStatus(newStatus);
transfer.updateStatus();
}
示例13: getStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public Status getStatus() {
return status;
}
示例14: setStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public void setStatus(Status status) {
this.status = status;
}
示例15: equalsStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
private boolean equalsStatus(Status status, Status otherStatus) {
return status == null ? otherStatus == null : status.equals(otherStatus);
}