Package com.deltawalker.script
Class UriInfo
java.lang.Object
com.deltawalker.script.UriInfo
The location of a resource together with the information needed to access
and read it: for a resource on a remote (S)FTP(S) server, the user name and
password, or the SSH key and passphrase; for a text file, the character
encoding and line ending to read or save it with.
The URI can be a local path or a URL such as ftp://host/path or
sftp://host/path. The optional properties are passed as a
JavaScript object whose property names are the names listed for each
UriInfo.Key constant:
const UriInfo = Java.type('com.deltawalker.script.UriInfo');
const local = new UriInfo('/Users/me/project');
const remote = new UriInfo('sftp://example.com/var/www',
{username: 'me', password: 'secret'});
const text = new UriInfo('/Users/me/notes.txt', {encoding: 'UTF-8'});
An unsupported property name makes the comparison or report that uses this
UriInfo fail with an IllegalArgumentException.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
UriInfo
Creates aUriInfofor the specified URI or path, with no properties. For instance, for an FTP server that does not require authentication:new UriInfo('ftp://example.com')- Parameters:
uri- the URI or path; cannot benullor empty- Throws:
NullPointerException- ifuriisnullIllegalArgumentException- ifuriis empty- Since:
- 2.0
-
UriInfo
Creates aUriInfofor the specified URI or path with the specified properties. For instance, for an SFTP server:new UriInfo('sftp://example.com', {username: 'me', password: 'secret'})- Parameters:
uri- the URI or path; cannot benullor emptyprops- the properties, as a JavaScript object whose property names are those listed for theUriInfo.Keyconstants and whose values are strings; can benullfor no properties- Throws:
NullPointerException- ifuriisnullIllegalArgumentException- ifuriis empty- Since:
- 2.0
-
-
Method Details
-
equals
-
getUri
Returns the URI or path of thisUriInfo, as passed to the constructor.- Returns:
- the URI or path
- Since:
- 2.0
-
properties
Returns the properties of thisUriInfo.- Returns:
- the map of property names to values; empty, never
null, when there are no properties - Since:
- 2.0
-
property
Returns the value of the property with the specified name.- Parameters:
key- the name of the property, for example"username"; cannot benullor emptydefValue- the value to return if thisUriInfohas no such property; can benull- Returns:
- the value of the property, or
defValue - Throws:
NullPointerException- ifkeyisnullIllegalArgumentException- ifkeyis empty- Since:
- 2.0
-
toString
-