Java 类org.jivesoftware.smackx.filetransfer.IncomingFileTransfer 实例源码

项目:NewCommunication-Android    文件:XmppManager.java   
public void getFile(){

    manager.addFileTransferListener(new FileTransferListener() {

    @Override
    public void fileTransferRequest(FileTransferRequest request) {

        IncomingFileTransfer fileTransfer = request.accept();

        try {
            fileTransfer.recieveFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "�����ļ�"));
        } catch (XMPPException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
});
  }
项目:synergynet3.1    文件:FileReceiver.java   
@Override
public void fileTransferRequest(final FileTransferRequest request)
{
    log.fine("Received file transfer request " + request);
    final String uniqueFileIdentifier = request.getDescription();
    final MD5Hash hash = new MD5Hash(uniqueFileIdentifier);
    final File temporaryIncomingFile = getTemporaryFileToStoreIncomingTransfer();
    log.fine("File " + request.getFileName() + " being saved as " + temporaryIncomingFile.getAbsolutePath());

    final IncomingFileTransfer transfer = request.accept();
    try
    {
        transfer.recieveFile(temporaryIncomingFile);
        FileTransferWorker fileTransferWorker = new FileTransferWorker(new FileTransferWorker.FileTransferWorkerDelegate()
        {
            @Override
            public void transferComplete()
            {
                fileTransferDidComplete(request.getFileName(), temporaryIncomingFile, hash, transfer);
            }

        }, transfer);
        fileTransferWorker.start();

    }
    catch (XMPPException ex)
    {
        log.log(Level.SEVERE, null, ex);
    }
}
项目:commune    文件:IncomingTransfer.java   
public IncomingTransfer(Module module, DeploymentID listenerID, File file, IncomingFileTransfer transfer,
                                TransferHandle handle, long inactivityTimeout, long fileSize,
                                boolean notifyProgress) {

    super(module, listenerID, inactivityTimeout, handle, file, fileSize, notifyProgress);
    this.transfer = transfer;
    this.listenerID = listenerID;
}
项目:commune    文件:IncomingTransfersManager.java   
public void accept(IncomingTransferHandle handle, DeploymentID listenerID) {

    File destination = handle.getLocalFile(); 
    long inactivityTimeout = handle.getInactivityTimeout();
    boolean receiveProgressUpdates = handle.isReceiveProgressUpdate();

    LOG.debug( "Accepting transfer. Handle: " + handle + ", dest: " + destination.getAbsolutePath() );

    createSubFolders(destination);

    FileTransferRequest fileTransferRequest = handlersRequestMap.get( handle );
    final IncomingFileTransfer transfer = fileTransferRequest.accept();

    IncomingTransfer fileTransfer = new IncomingTransfer(module, listenerID, destination, transfer, handle,
        inactivityTimeout, fileTransferRequest.getFileSize(), receiveProgressUpdates);

    if ( receiveProgressUpdates ) {
        TransferProgress transferProgress = new TransferProgress( handle, destination.getName(),
            fileTransferRequest.getFileSize(), transfer.getStatus(), 0L, 0D, 0, false );
        Message message = 
            AbstractTransfer.createUpdateTransferProgressMessage(module.getContainerID(), listenerID, 
                    transferProgress);
        module.sendMessage(message);
    }

    try {
        fileTransfer.start();
    } catch (IllegalArgumentException e) {
        LOG.error("Destination is not writable. Handle: " + handle + ", dest: " + destination.getAbsolutePath());
        reject(handle);
    }

    addTransfer(handle, fileTransfer);
}
项目:XMPPSample_Studio    文件:LiveApp.java   
public void putFileTransfer(String path, IncomingFileTransfer fileTransfer) {
    fileTransfers.put(path, fileTransfer);
}
项目:XMPPSample_Studio    文件:LiveApp.java   
public IncomingFileTransfer getFileTransfer(String path) {
    return fileTransfers.get(path);
}
项目:synergynet3.1    文件:FileTransferWorker.java   
/**
 * Instantiates a new file transfer worker.
 *
 * @param delegate
 *            the delegate
 * @param transfer
 *            the transfer
 */
public FileTransferWorker(FileTransferWorkerDelegate delegate, IncomingFileTransfer transfer)
{
    this.delegate = delegate;
    this.transfer = transfer;
}