Static Public Member Functions | |
static String | createTempDirectory () |
static String | findPackage (String pkgname) |
static File | retrieve (String url) |
static File | retrieve (String url, boolean checkAlreadyRetrieved) |
Static Private Member Functions | |
static File | getTmpName (String url, String filename) |
static String | MD5 (String md5) |
Static Private Attributes | |
static final String | tmpPrefix = "knowrob_resource_" |
Retrieves a file from given url to a temporary path and returns this path. Supported protocol types: http, ftp, package
Notes about package type: You can use an url like 'package://mod_vis/path/to/file.zip' to get the physical file path of the specified file in the package. So this url will be transformed to something like: '/path_to_ros/mod_vis/path/to/file.zip' ResourceRetriever tries to find the specified package by calling "rospack find PACKAGE"
Definition at line 39 of file ResourceRetriever.java.
static String edu.tum.cs.ias.knowrob.utils.ResourceRetriever.createTempDirectory | ( | ) | [inline, static] |
Creates a temporary directory (normally in the /tmp folder)
Definition at line 51 of file ResourceRetriever.java.
static String edu.tum.cs.ias.knowrob.utils.ResourceRetriever.findPackage | ( | String | pkgname | ) | [inline, static] |
Tries to find the specified ros package by calling 'rospack find'.
pkgname | Package to search for |
Definition at line 71 of file ResourceRetriever.java.
static File edu.tum.cs.ias.knowrob.utils.ResourceRetriever.getTmpName | ( | String | url, |
String | filename | ||
) | [inline, static, private] |
Creates a temporary filename. The filename is in the format: {tmpPrefix}+{MD5(url)}+{ext(filename)}. So this function will create always the same temporary name for the same URL.
url | Url as identifier. |
filename | Filename for getting the file name extension. |
Definition at line 104 of file ResourceRetriever.java.
static String edu.tum.cs.ias.knowrob.utils.ResourceRetriever.MD5 | ( | String | md5 | ) | [inline, static, private] |
Calculate MD5 checksum of the given string.
md5 | Value to calculate md5 for. |
Definition at line 128 of file ResourceRetriever.java.
static File edu.tum.cs.ias.knowrob.utils.ResourceRetriever.retrieve | ( | String | url | ) | [inline, static] |
Retrieve a file to a temporary path. This temporary path will be returned. Valid protocol types: ftp, http, package or local file If a file has already be downloaded (the file is existing in tmp directory) it will not be redownloaded again. Simply the path to this file will be returned.
url | URL to retrieve |
Definition at line 157 of file ResourceRetriever.java.
static File edu.tum.cs.ias.knowrob.utils.ResourceRetriever.retrieve | ( | String | url, |
boolean | checkAlreadyRetrieved | ||
) | [inline, static] |
Retrieve a file to a temporary path. This temporary path will be returned. Valid protocol types: ftp, http, package or local file If a file has already be downloaded (the file is existing in tmp directory) it will not be redownloaded again. Simply the path to this file will be returned.
url | URL to retrieve |
checkAlreadyRetrieved | if false, always download the file and ignore, if it is already existing |
Definition at line 173 of file ResourceRetriever.java.
final String edu.tum.cs.ias.knowrob.utils.ResourceRetriever.tmpPrefix = "knowrob_resource_" [static, private] |
Prefix for files in /tmp folder
Definition at line 44 of file ResourceRetriever.java.