Search in sources :

Example 1 with FileTransferParams

use of org.eclipse.ecf.example.collab.share.io.FileTransferParams in project ecf by eclipse.

the class ChatComposite method readStreamAndSend.

protected void readStreamAndSend(java.io.InputStream local, String fileName, Date startDate, ID target, final boolean launch) {
    try {
        final ID eclipseStageID = IDFactory.getDefault().createStringID(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject.ID);
        final java.io.BufferedInputStream ins = new java.io.BufferedInputStream(local);
        final java.io.File remoteFile = new File((new File(fileName)).getName());
        final FileTransferParams sp = new FileTransferParams(remoteFile, getChunkPreference(), getDelayPreference(), null, true, -1, null);
        final Object[] args = { view, target, ins, sp, eclipseStageID };
        // Do it
        new Thread(new Runnable() {

            public void run() {
                if (launch) {
                    ChatComposite.this.view.createObject(null, org.eclipse.ecf.example.collab.share.io.EclipseFileTransferAndLaunch.class.getName(), new String[] { FileSenderUI.class.getName(), ID.class.getName(), java.io.InputStream.class.getName(), FileTransferParams.class.getName(), ID.class.getName() }, args);
                } else {
                    ChatComposite.this.view.createObject(null, org.eclipse.ecf.example.collab.share.io.EclipseFileTransfer.class.getName(), new String[] { FileSenderUI.class.getName(), ID.class.getName(), java.io.InputStream.class.getName(), FileTransferParams.class.getName(), ID.class.getName() }, args);
                }
            }
        }, "FileRepObject creator").start();
    } catch (final Exception e) {
        if (this.view.lch != null)
            // $NON-NLS-1$
            this.view.lch.chatException(e, "readStreamAndSend()");
    }
}
Also used : FileTransferParams(org.eclipse.ecf.example.collab.share.io.FileTransferParams) File(java.io.File) IOException(java.io.IOException) ID(org.eclipse.ecf.core.identity.ID) File(java.io.File) FileSenderUI(org.eclipse.ecf.example.collab.share.io.FileSenderUI)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 ID (org.eclipse.ecf.core.identity.ID)1 FileSenderUI (org.eclipse.ecf.example.collab.share.io.FileSenderUI)1 FileTransferParams (org.eclipse.ecf.example.collab.share.io.FileTransferParams)1