本文整理汇总了Java中org.jivesoftware.smackx.filetransfer.FileTransfer.Status类的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Status类属于org.jivesoftware.smackx.filetransfer.FileTransfer包,在下文中一共展示了Status类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:zhaozw,项目名称:android-1,代码行数:28,代码来源:OperationSetFileTransferJabberImpl.java
示例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;
}
开发者ID:OurGrid,项目名称:commune,代码行数:13,代码来源:TransferProgress.java
示例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;
}
开发者ID:OurGrid,项目名称:commune,代码行数:14,代码来源:TransferData.java
示例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;
}
开发者ID:OurGrid,项目名称:commune,代码行数:9,代码来源:TransferDataMatcher.java
示例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);
}
开发者ID:OurGrid,项目名称:commune,代码行数:33,代码来源:TestGetFileTransfers.java
示例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);
}
开发者ID:OurGrid,项目名称:commune,代码行数:13,代码来源:TestGetFileTransfersUtil.java
示例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);
开发者ID:ikantech,项目名称:yiim_v2,代码行数:3,代码来源:FileUpload.java
示例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();
}
开发者ID:ikantech,项目名称:yiim_v2,代码行数:73,代码来源:FileUpload.java
示例9: getNewStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public Status getNewStatus() {
return this.newStatus;
}
开发者ID:OurGrid,项目名称:commune,代码行数:4,代码来源:TransferProgress.java
示例10: getCurrentStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public Status getCurrentStatus() {
return this.currentStatus;
}
开发者ID:OurGrid,项目名称:commune,代码行数:4,代码来源:AbstractTransfer.java
示例11: setCurrentStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public void setCurrentStatus(Status currentStatus) {
this.currentStatus = currentStatus;
}
开发者ID:OurGrid,项目名称:commune,代码行数:4,代码来源:AbstractTransfer.java
示例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();
}
开发者ID:OurGrid,项目名称:commune,代码行数:6,代码来源:TestableFileTransferProcessor.java
示例13: getStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public Status getStatus() {
return status;
}
开发者ID:OurGrid,项目名称:commune,代码行数:4,代码来源:TransferData.java
示例14: setStatus
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public void setStatus(Status status) {
this.status = status;
}
开发者ID:OurGrid,项目名称:commune,代码行数:4,代码来源:TransferData.java
示例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);
}
开发者ID:OurGrid,项目名称:commune,代码行数:4,代码来源:TransferDataMatcher.java
示例16: eqMatcher
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
public static Collection<TransferData> eqMatcher(DeploymentID destinationID, DeploymentID listenerID, Status status, File file,
int queuePosition, boolean isIncoming) {
EasyMock.reportMatcher(new TransferDataMatcher(destinationID, listenerID, status, file, queuePosition, isIncoming));
return null;
}
开发者ID:OurGrid,项目名称:commune,代码行数:6,代码来源:TransferDataMatcher.java
示例17: updateBar
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; //导入依赖的package包/类
private void updateBar(final OutgoingFileTransfer transfer, String nickname, String kBperSecond) {
FileTransfer.Status status = transfer.getStatus();
if (status == Status.negotiating_stream) {
titleLabel.setText(Res.getString("message.negotiation.file.transfer", nickname));
}
else if (status == Status.error) {
if (transfer.getException() != null) {
Log.error("Error occured during file transfer.", transfer.getException());
}
progressBar.setVisible(false);
progressLabel.setVisible(false);
titleLabel.setText(Res.getString("message.unable.to.send.file", nickname));
cancelButton.setVisible(false);
retryButton.setVisible(true);
showAlert(true);
}
else if (status == Status.in_progress) {
titleLabel.setText(Res.getString("message.sending.file.to", nickname));
showAlert(false);
if (!progressBar.isVisible()) {
progressBar.setVisible(true);
progressLabel.setVisible(true);
}
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
// 100 % = Filesize
// x % = Currentsize
long p = (transfer.getBytesSent() * 100 / transfer.getFileSize() );
progressBar.setValue(Math.round(p));
}
});
}
catch (Exception e) {
Log.error(e);
}
ByteFormat format = new ByteFormat();
String bytesSent = format.format(transfer.getBytesSent());
String est = TransferUtils.calculateEstimate(transfer.getBytesSent(), transfer.getFileSize(), _starttime, System.currentTimeMillis());
progressLabel.setText(Res.getString("message.transfer.progressbar.text.sent", bytesSent, kBperSecond, est));
}
else if (status == Status.complete) {
progressBar.setVisible(false);
String fin = TransferUtils.convertSecondstoHHMMSS(Math.round(System.currentTimeMillis()-_starttime)/1000);
progressLabel.setText(Res.getString("label.time", fin));
titleLabel.setText(Res.getString("message.you.have.sent", nickname));
cancelButton.setVisible(false);
showAlert(true);
}
else if (status == Status.cancelled) {
progressBar.setVisible(false);
progressLabel.setVisible(false);
titleLabel.setText(Res.getString("message.file.transfer.canceled"));
cancelButton.setVisible(false);
retryButton.setVisible(true);
showAlert(true);
}
else if (status == Status.refused) {
progressBar.setVisible(false);
progressLabel.setVisible(false);
titleLabel.setText(Res.getString("message.file.transfer.rejected", nickname));
cancelButton.setVisible(false);
retryButton.setVisible(true);
showAlert(true);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:72,代码来源:SendFileTransfer.java
注:本文中的org.jivesoftware.smackx.filetransfer.FileTransfer.Status类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论