throw new FileTransferException(FileTransferError.READING_SOURCE); throw new FileTransferException(FileTransferError.WRITING_DESTINATION, totalRead);
sizeLeft -= written; } catch (FileTransferException e) { if (e.getReason() == FileTransferError.WRITING_DESTINATION) { sizeLeft -= e.getBytesWritten(); showErrorDialog(ActionProperties.getActionLabel(SplitFileAction.Descriptor.ACTION_ID), Translator.get("split_file_dialog.insert_new_media"),
switch(e.getReason()) {
@Override public void copyStream(InputStream in, boolean append, long length) throws FileTransferException { if ((append == true) || (length == -1)) { super.copyStream(in, append, length); } else { try { doCopyRemoteFileName(in, length); } catch (IOException e) { LOGGER.error("Failed copying stream", e); throw new FileTransferException(FileTransferError.UNKNOWN); } } }
throw new FileTransferException(FileTransferError.READING_SOURCE); throw new FileTransferException(FileTransferError.WRITING_DESTINATION);
throw new FileTransferException(FileTransferError.SOURCE_AND_DESTINATION_IDENTICAL); throw new FileTransferException(FileTransferError.SOURCE_PARENT_OF_DESTINATION); throw new FileTransferException(FileTransferError.FILE_NOT_FOUND);
throw new FileTransferException(FileTransferError.OPENING_DESTINATION); throw new FileTransferException(FileTransferError.CLOSING_DESTINATION);
throw new FileTransferException(FileTransferError.WRITING_DESTINATION); throw new FileTransferException(FileTransferError.READING_SOURCE); throw new FileTransferException(FileTransferError.OPENING_DESTINATION); throw new FileTransferException(FileTransferError.OPENING_SOURCE); throw new FileTransferException(FileTransferError.CLOSING_SOURCE);
/** * Returns the checksum (also referred to as <i>hash</i> or <i>digest</i>) of the given <code>InputStream</code> * calculated by reading the stream and feeding the bytes to the given <code>MessageDigest</code> until EOF is * reached. * * <p><b>Important:</b> this method does not close the <code>InputStream</code>, and does not reset the * <code>MessageDigest</code> after the checksum has been calculated.</p> * * @param in the InputStream for which to calculate the checksum * @param messageDigest the MessageDigest to use for calculating the checksum * @return the given InputStream's checksum, as an hexadecimal string * @throws IOException if an I/O error occurred while calculating the checksum */ public static String calculateChecksum(InputStream in, MessageDigest messageDigest) throws IOException { ChecksumInputStream cin = new ChecksumInputStream(in, messageDigest); try { StreamUtils.readUntilEOF(cin); return cin.getChecksumString(); } catch(IOException e) { throw new FileTransferException(FileTransferError.READING_SOURCE); } }
if(append) { throw new FileTransferException(FileTransferError.READING_SOURCE); throw new FileTransferException(FileTransferError.OPENING_DESTINATION); throw new FileTransferException(FileTransferError.OPENING_SOURCE);
throw new FileTransferException(FileTransferError.SOURCE_AND_DESTINATION_IDENTICAL); throw new FileTransferException(FileTransferError.OPENING_SOURCE); throw new FileTransferException(FileTransferError.READING_SOURCE); throw new FileTransferException(FileTransferError.READING_DESTINATION); throw new FileTransferException(FileTransferError.CHECKSUM_MISMATCH);
throw new FileTransferException(FileTransferError.DELETING_SOURCE);
throw new FileTransferException(FileTransferError.UNKNOWN);