public long getFileLength() { return fileTransferInfo.getFileSize(); }
protected void openStreams() throws SendFileTransferException { try { File localFile = getFileTransferInfo().getFile(); // Set input stream from local file setInputStream(new BufferedInputStream(new FileInputStream(localFile))); // Then connect connect(); // Make PUT request setOutputStream(urlConnection.getOutputStream()); } catch (final Exception e) { throw new SendFileTransferException(NLS.bind(Messages.UrlConnectionOutgoingFileTransfer_EXCEPTION_COULD_NOT_CONNECT, getRemoteFileURL().toString()), e); } }
protected void openStreams() throws SendFileTransferException { IFileTransferInfo localFileTransferInfo = getFileTransferInfo(); Assert.isNotNull(localFileTransferInfo); // Setup input file File inputFile = localFileTransferInfo.getFile(); try { setInputStream(new BufferedInputStream(new FileInputStream(inputFile))); } catch (Exception e) { hardClose(); throw new SendFileTransferException(NLS.bind(Messages.LocalFileOutgoingFileTransfer_EXCEPTION_OPENING_FOR_INPUT, inputFile)); } URL url = getRemoteFileURL(); Assert.isNotNull(url); try { File outputFile = new File(url.getPath()); setOutputStream(new BufferedOutputStream(new FileOutputStream(outputFile))); } catch (Exception e) { hardClose(); throw new SendFileTransferException(NLS.bind(Messages.LocalFileOutgoingFileTransfer_EXCEPTION_OPENING_FOR_OUTPUT, url)); } }
public String toString() { final StringBuffer sb = new StringBuffer("IOutgoingFileTransferSendDataEvent["); //$NON-NLS-1$ sb.append("bytesSent=").append(bytesSent) //$NON-NLS-1$ .append(";fileLength=").append(fileTransferInfo.getFileSize()) //$NON-NLS-1$ .append("]"); //$NON-NLS-1$ return sb.toString(); } });
public String toString() { final StringBuffer sb = new StringBuffer("IOutgoingFileTransferSendDoneEvent["); //$NON-NLS-1$ sb.append("bytesSent=").append(bytesSent) //$NON-NLS-1$ .append(";fileLength=").append(fileTransferInfo.getFileSize()).append(";exception=").append(getException()) //$NON-NLS-1$ //$NON-NLS-2$ .append("]"); //$NON-NLS-1$ return sb.toString(); } });
public IStatus performFileTransfer(IProgressMonitor monitor) { final byte[] buf = new byte[buff_length]; final long totalWork = ((fileTransferInfo.getFileSize() == -1) ? 100 : fileTransferInfo.getFileSize()); double factor = (totalWork > Integer.MAX_VALUE) ? (((double) Integer.MAX_VALUE) / ((double) totalWork)) : 1.0; int work = (totalWork > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) totalWork;