Static Public Member Functions | Static Private Member Functions | Static Private Attributes
edu.tum.cs.ias.knowrob.utils.ResourceRetriever Class Reference

List of all members.

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_"

Detailed Description

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"

Author:
Stefan Profanter

Definition at line 39 of file ResourceRetriever.java.


Member Function Documentation

Creates a temporary directory (normally in the /tmp folder)

Returns:
File with path to created dir

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'.

Parameters:
pkgnamePackage to search for
Returns:
Absolute path to the package or null if not found

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.

Parameters:
urlUrl as identifier.
filenameFilename for getting the file name extension.
Returns:
null if MD5(url) returns null. Otherwise it returns the temp filename.
See also:
MD5

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.

Parameters:
md5Value to calculate md5 for.
Returns:
null if encoding unsupported or algorithm not found

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.

Parameters:
urlURL to retrieve
Returns:
NULL on error. On success the path to the file is returned.

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.

Parameters:
urlURL to retrieve
checkAlreadyRetrievedif false, always download the file and ignore, if it is already existing
Returns:
NULL on error. On success the path to the file is returned.

Definition at line 173 of file ResourceRetriever.java.


Member Data Documentation

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.


The documentation for this class was generated from the following file:


knowrob_common
Author(s): Moritz Tenorth
autogenerated on Sat Dec 28 2013 17:09:28