public class FileUtils
extends java.lang.Object
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static java.io.FileOutputStream |
createTempFileOutputStream(java.net.URL url,
java.lang.String extension,
boolean dryRun,
java.io.File[] tempFile,
java.lang.String preferredFileName,
java.lang.String preferredExtension)
Tries to create a new FileOutputStream for a temporary file into
which a remote file is to be downloaded.
|
static java.io.File |
download(java.lang.String url,
java.lang.String preferredFileName,
java.lang.String preferredExtension)
Downloads a remote file specified by its URL into a local file.
|
public static java.io.File download(java.lang.String url, java.lang.String preferredFileName, java.lang.String preferredExtension) throws java.io.IOException
url
- the URL of the remote file to downloadpreferredFileName
- the file name we will use if it is not possible
to use the file name and extension from the URL providedpreferredExtension
- the extension name we will use if it is not
possible to use the file name and extension from the URL provided.
The extension should be in the form '.exe', '.bz2' etc.java.io.IOException
- if an I/O error occurs during the downloadpublic static java.io.FileOutputStream createTempFileOutputStream(java.net.URL url, java.lang.String extension, boolean dryRun, java.io.File[] tempFile, java.lang.String preferredFileName, java.lang.String preferredExtension) throws java.io.IOException
url
- the URL of the file to be downloadedextension
- the extension of the File to be created or
null for the default (which may be derived from url)dryRun
- true to generate a File in
tempFile and not open it or false to generate a
File in tempFile and open ittempFile
- a File array of at least one element which is to
receive the created File instance at index zero (if successful)preferredFileName
- the file name we will use if it is not possible
to use the file name and extension from the URL providedpreferredExtension
- the extension name we will use if it is not
possible to use the file name and extension from the URL provided.
The extension should be in the form '.exe', '.bz2' etc.java.io.IOException
- if anything goes wrong while creating the new
FileOutputStream
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.