Package org.jivesoftware.smackx.filetransfer

Examples of org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer


    fileDialog.setText("Choose file to send to " + user);
    String file = fileDialog.open();
    if(file == null) return false;
   
    FileTransferManager manager = new FileTransferManager(account.xmpp.getConnection());
    final OutgoingFileTransfer outgoingFileTransfer = manager.createOutgoingFileTransfer(user);
   
    final File f = new File(file);
    InputDialog descriptionInput = new InputDialog(parent,
        "Sending file to " + user,
        "Please Provide a description of the file (" + f.getName() + ") " +
          "you want to send to " + user,
        "",null);
    if(descriptionInput.open() != InputDialog.OK) return false;
    try {
      outgoingFileTransfer.sendFile(f,descriptionInput.getValue());
     
      final String task = "Sending file " + f.getName() + " to " + user;
      showProgressMonitor(parent, outgoingFileTransfer, task);
    } catch (Exception e) {
      throw new RuntimeException("Error while trying to send file.",e);
View Full Code Here



    // strJidreceiver muss der Form "test2@192.168.1.143/Smack" entsprechen, also mit / und der Ressource
    public void sendFile(String strJidreceiver){
        FileTransferManager manager = new FileTransferManager(xmppconnection);
        OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(strJidreceiver);

        OpenDialog opendialogsendfile = new OpenDialog(true);
        if (opendialogsendfile.getAbortedStatus() != true){
            try {
                transfer.sendFile(new File(opendialogsendfile.getCompletePath()),opendialogsendfile.getFileDescription());
                new Progress((int) transfer.getFileSize(), chatwindow, transfer);
            }
            catch (XMPPException e) {
                e.printStackTrace();
            }
        }
View Full Code Here

   
   
  }

  void send(String recver,File file) throws XMPPException{
    OutgoingFileTransfer outTransfer = fileTransferManager.createOutgoingFileTransfer(recver);
    outTransfer.sendFile(file, "");
  }
View Full Code Here

      } else {
        // Create the file transfer manager
        FileTransferManager manager = new FileTransferManager(conn);

        // Create the outgoing file transfer
        OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(to);

        InputStream is = null;
        try {
          URL url = new URL(attachmentUrl);
          // Send the file
          is = url.openStream();
          OutgoingFileTransfer.setResponseTimeout(10000);
          transfer.sendStream(is, url.getFile(), is.available(), message);
          logger.debug("Sent message '{}' with attachment '{}' to '{}'.", new String[] { message, attachmentUrl, to });
          success = true;
        } catch (IOException e) {
          logger.error("Could not open url '{}' for sending it via XMPP", attachmentUrl, e);
        } finally {
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.