/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to proceed. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("ReceiveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
@Override public void run() { if (transfer.getAmountWritten() >= request.getFileSize() || transfer.getStatus() == FileTransfer.Status.error || transfer.getStatus() == FileTransfer.Status.refused || transfer.getStatus() == FileTransfer.Status.cancelled || transfer.getStatus() == FileTransfer.Status.complete) { this.cancel(); timer.cancel(); _endtime = System.currentTimeMillis(); updateonFinished(request, downloadedFile); }else { // 100 % = Filesize // x % = Currentsize long p = (transfer.getAmountWritten() * 100 / transfer.getFileSize() ); progressBar.setValue(Math.round(p)); } } };
public void acceptFileTransfer(final FileTransferRequest request) { String fileName = request.getFileName(); long fileSize = request.getFileSize(); Jid requestor = request.getRequestor(); BareJid bareJID = requestor.asBareJid();
@Override public void run() { if (transfer.getAmountWritten() >= request.getFileSize() || transfer.getStatus() == FileTransfer.Status.error || transfer.getStatus() == FileTransfer.Status.refused
private void updateonFinished(final FileTransferRequest request, final File downloadedFile) { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); transfer.getAmountWritten() < request.getFileSize()) { transferMessage = Res.getString("message.transfer.cancelled"); else if(transfer.getAmountWritten() >= request.getFileSize())