public class FileRetriever extends Object
Modifier and Type | Field and Description |
---|---|
static File |
CACHE_DIR
The cache dir.
|
static boolean |
FIND_LOCAL
Are we allowed to search for local files?.
|
static boolean |
FIND_REMOTE
Are we allowed to search for files on the Internet?.
|
Constructor and Description |
---|
FileRetriever() |
Modifier and Type | Method and Description |
---|---|
protected static void |
copy(URI from,
File to,
boolean local)
Copy a file.
|
protected static void |
download(URI from,
File to)
Download a file from a remote location..
|
static void |
getFile(URI file,
File dest)
Retrieves a file from an URI.
|
static URI |
getUri(String href,
URI base)
Compute an URI location.
|
static boolean |
setUpCache(File directory)
Sets the up caching.
|
public static File CACHE_DIR
public static boolean FIND_LOCAL
public static boolean FIND_REMOTE
public static boolean setUpCache(File directory)
directory
- the directory to write topublic static URI getUri(String href, URI base) throws URISyntaxException, IOException
href
- the hrefbase
- the base URIURISyntaxException
- the URI syntax exceptionIOException
- the IO exceptionprotected static void copy(URI from, File to, boolean local) throws IOException
from
- the originto
- the destinationIOException
- the IO exceptionprotected static void download(URI from, File to) throws IOException
from
- the originto
- the destinationIOException
- the IO exceptionpublic static void getFile(URI file, File dest) throws IOException, URISyntaxException
file
- the URI to the filedest
- the destination to write toIOException
- Signals that an I/O exception has occurred.URISyntaxException
- thrown if file or base have a strange formatCopyright © 2014. All rights reserved.