public final class VfsMethods extends Object
This class provides one-liner methods for sending/receiving files to/from a remote server.
Connects to an external URL to retrieve/send the content of files.
Constructor and Description |
---|
VfsMethods(io.toro.martini.email.EmailClient esbEmailClient,
io.toro.martini.vfs.VfsClient esbVfsClient) |
Modifier and Type | Method and Description |
---|---|
static void |
close(org.apache.commons.vfs2.FileObject fileObject)
Closes a
FileObject . |
static String |
copyTo(String sourceUrl,
String targetUrl)
Copy the item found in the source url to the target url.
|
static void |
createFile(org.apache.commons.vfs2.FileObject fileObject)
Creates the provided file, if it does not exist.
|
static void |
createFolder(org.apache.commons.vfs2.FileObject fileObject)
Creates the provided folder, if it does not exist.
|
static boolean |
delete(org.apache.commons.vfs2.FileObject fileObject)
Deletes a file.
|
static void |
deleteAll(org.apache.commons.vfs2.FileObject fileObject)
Deletes a file and its children, if any.
|
static boolean |
exists(org.apache.commons.vfs2.FileObject fileObject)
Determines if the provided file exists.
|
static org.apache.commons.vfs2.FileObject |
file(String url)
Gets the
FileObject of a file that's on a virtual file system. |
static org.apache.commons.vfs2.FileObject |
file(String url,
Map properties)
Gets the
FileObject of a file that's on a virtual file system. |
static Object |
getAttribute(org.apache.commons.vfs2.FileContent fileContent,
String attrName)
Get the attribute value of a named file attribute.
|
static String[] |
getAttributeNames(org.apache.commons.vfs2.FileContent fileContent)
Get the attribute names of a file.
|
static GloopModel |
getChild(org.apache.commons.vfs2.FileObject fileObject,
String name)
Returns the child
FileObject of the provided FileObject . |
static GloopModel |
getChildren(org.apache.commons.vfs2.FileObject fileObject)
Gets the children of a
FileObject . |
static GloopModel |
getContent(org.apache.commons.vfs2.FileObject fileObject)
Get the content of the provided
FileObject . |
static GloopModel |
getFile(org.apache.commons.vfs2.FileContent fileObject)
Get the
FileObject to which the provided FileContent belongs to |
static InputStream |
getInputStream(org.apache.commons.vfs2.FileContent fileContent)
Get an input stream for reading the provided file content.
|
static long |
getLastModifiedTime(org.apache.commons.vfs2.FileContent fileContent)
Get the time the file content was last modified.
|
static GloopModel |
getName(org.apache.commons.vfs2.FileObject fileObject)
Get the name of the provided
FileObject . |
static OutputStream |
getOutputStream(org.apache.commons.vfs2.FileContent fileContent)
Gets the output stream of the file content object if it's a file.
|
static GloopModel |
getParent(org.apache.commons.vfs2.FileObject fileObject)
Get the parent of a
FileObject . |
static long |
getSize(org.apache.commons.vfs2.FileContent fileContent)
Get the size of the provided file content.
|
static GloopModel |
getVfsFile(String url,
GloopModel vfsFileSystemOptions,
GloopExecutionContext context)
Gets the
FileObject of a file that's on a virtual file system. |
static boolean |
hasAttribute(org.apache.commons.vfs2.FileContent fileContent,
String attributeName)
Determines whether or not a file has a specific attribute.
|
static boolean |
isOpen(org.apache.commons.vfs2.FileContent fileContent)
Checks whether or not a file is open.
|
static void |
readFile(org.apache.commons.vfs2.FileContent fileContent,
org.apache.commons.vfs2.FileContent targetContent)
Reads the content from the
fileContent , writing it to targetContent . |
static void |
readFile(org.apache.commons.vfs2.FileContent fileContent,
org.apache.commons.vfs2.FileObject targetObject)
Reads the content from the
fileContent , writing it to targetObject . |
static void |
readFile(org.apache.commons.vfs2.FileContent fileContent,
OutputStream outputStream,
int bufferSize)
Reads the content from the
fileContent , writing it to outputStream . |
static byte[] |
readFileAsBytes(org.apache.commons.vfs2.FileContent fileContent,
int bufferSize)
Reads the content of the file, returning it as an array of bytes.
|
static String |
readFileAsString(org.apache.commons.vfs2.FileContent fileContent,
int bufferSize)
Reads the content of the file, returning it as a string.
|
static Message[] |
receive(String url)
Retrieve an array of unread email messages.
|
static Message[] |
receive(String url,
boolean delete)
Retrieve an array of unused email messages.
|
static void |
refresh(org.apache.commons.vfs2.FileObject fileObject)
Synchronize the file with the underlying file system.
|
static void |
removeAttribute(org.apache.commons.vfs2.FileContent fileContent,
String attributeName)
Removes an attribute from a file
|
static GloopModel |
resolveFile(org.apache.commons.vfs2.FileObject fileObject,
String path)
Resolve a file relative to the provided
FileObject . |
static byte[] |
send(String url,
byte[] data)
Sends bytes of data to a remote location.
|
static byte[] |
send(String url,
byte[] data,
Map properties)
Sends bytes of data to a remote location.
|
static File |
send(String url,
File file)
Sends a file to a remote location.
|
static void |
send(String url,
InputStream is)
Sends stream to a remote location.
|
static File |
send(String url,
Map properties,
File file)
Sends a file to a remote location.
|
static void |
send(String url,
Map properties,
InputStream is)
Sends a stream to a remote location.
|
static void |
send(String url,
Map properties,
Reader reader)
Sends the contents of a reader to a remote location.
|
static void |
send(String url,
Map properties,
Reader data,
List<DataSource> attachment)
Sends bytes of data to a remote location.
|
static String |
send(String url,
Map properties,
String data)
Sends string to a remote location.
|
static String |
send(String url,
Map properties,
String data,
List<DataSource> attachment)
Sends string to a remote location.
|
static void |
send(String url,
Reader reader)
Sends the contents of a reader to a remote location.
|
static String |
send(String url,
String data)
Sends string to a remote location.
|
static byte[] |
sendTo(byte[] data,
String url)
Sends bytes of data to a remote location.
|
static File |
sendTo(File file,
String url)
Sends a file to a remote location.
|
static File |
sendTo(File file,
String url,
Map properties)
Sends a file to a remote location.
|
static void |
sendTo(InputStream is,
String url)
Sends stream to a remote location.
|
static void |
sendTo(InputStream is,
String url,
Map properties)
Sends a stream to a remote location.
|
static void |
sendTo(Reader reader,
String url)
Sends the contents of a reader to a remote location.
|
static void |
sendTo(Reader reader,
String url,
Map properties)
Sends the contents of a reader to a remote location.
|
static byte[] |
sendTo(String url,
Map properties,
byte[] data)
Sends bytes of data to a remote location.
|
static String |
sendTo(String data,
String url)
Sends string to a remote location.
|
static String |
sendTo(String data,
String url,
Map properties)
Sends string to a remote location.
|
static void |
setAttribute(org.apache.commons.vfs2.FileContent fileContent,
String attributeName,
Object value)
Sets a file attribute's value
|
static void |
setExecutable(org.apache.commons.vfs2.FileObject fileObject,
boolean executable,
boolean ownerOnly)
Sets the executable flag of the
FileObject . |
static void |
setLastModifiedTime(org.apache.commons.vfs2.FileContent fileContent,
long lastModifiedTime)
Sets the last modified time of the given file if it it exists.
|
static void |
setReadable(org.apache.commons.vfs2.FileObject fileObject,
boolean readable,
boolean ownerOnly)
Sets the readable flag of the
FileObject . |
static void |
setWritable(org.apache.commons.vfs2.FileObject fileObject,
boolean writable,
boolean ownerOnly)
Sets the writeable flag of the
FileObject . |
static String |
vfsGet(String url)
Gets the string content of a file that's on a virtual file system.
|
static String |
vfsGet(String url,
Map properties)
Gets the string content of a file that's on a virtual file system.
|
static byte[] |
vfsGetBytes(String url)
Gets the byte array content of a file that's on a virtual file system.
|
static byte[] |
vfsGetBytes(String url,
Map properties)
Gets the stream of a file that's on a virtual file system.
|
static File |
vfsGetFile(String url,
String filename)
Gets the content of a file that's on a virtual file system and writes it to the given file.
|
static File |
vfsGetFile(String url,
String filename,
Map properties)
Writes a file from a virtual file system to the local file system.
|
static InputStream |
vfsGetInputStream(String url)
Gets the stream of a file that's on a virtual file system.
|
static void |
vfsGetInputStream(String url,
Closure closure)
Executes a closure upon fetching the stream of a file that's on a virtual file system.
|
static InputStream |
vfsGetInputStream(String url,
Map properties)
Gets the stream of a file that's on a virtual file system.
|
static void |
vfsGetInputStream(String url,
Map properties,
Closure closure)
Executes a closure upon fetching the stream of a file that's on a virtual file system.
|
static void |
vfsPut(String url,
byte[] data)
Alias for
send(String, byte[]) . |
static void |
vfsPut(String url,
byte[] data,
Map properties)
Alias for
#send(String, byte[], Map . |
static void |
vfsPut(String url,
InputStream data)
Alias for
#send(String, InputStream . |
static void |
vfsPut(String url,
InputStream data,
Map properties)
Alias for
send(String, Map, InputStream) . |
static void |
vfsPut(String url,
String data)
Alias for
send(String, String) . |
static void |
vfsPut(String url,
String data,
Map properties)
Alias for
send(String, Map, String) . |
static void |
writeFile(org.apache.commons.vfs2.FileContent fileContent,
byte[] data,
boolean append,
int bufferSize)
Writes an array of bytes to the file.
|
static void |
writeFile(org.apache.commons.vfs2.FileContent fileContent,
InputStream inputStream,
boolean append)
Writes the content of the input stream to the
fileContent , with a buffer size of 4096 . |
static void |
writeFile(org.apache.commons.vfs2.FileContent fileContent,
InputStream inputStream,
boolean append,
int bufferSize)
Writes the content of the input stream to the
fileContent . |
static void |
writeFile(org.apache.commons.vfs2.FileContent fileContent,
String data,
boolean append,
int bufferSize)
Writes the content of the input string to the file.
|
@Autowired VfsMethods(io.toro.martini.email.EmailClient esbEmailClient, io.toro.martini.vfs.VfsClient esbVfsClient)
public static String vfsGet(String url) throws ToroException
Gets the string content of a file that's on a virtual file system.
Supported file systems are:
Example usages:
println 'file://path/to/local-file.txt'.vfsGet() println 'http://www.home.com/remote-file.txt'.vfsGet() println 'https://www.secure-home.com/remote-file.txt'.vfsGet() println 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGet() println 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGet() println 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGet()
url
- the URL to download the remote file fromToroException
- if an error occurs during this operationpublic static String vfsGet(String url, Map properties) throws ToroException
Gets the string content of a file that's on a virtual file system.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
println 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGet([ssl:"false", passive:"true"])
Example usage in Dropbox:
println 'dbx://path/to/foo.txt'.vfsGet([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
println 'gdv://path/to/foo.txt'.vfsGet([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3
println 's3://path/to/foo.txt'.vfsGet([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
println 'od://path/to/foo.txt'.vfsGet([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri' ])
url
- the URL to download the remote file fromproperties
- optional properties for the requestToroException
- if an error occurs during this operationvfsGet(String)
public static InputStream vfsGetInputStream(String url, Map properties) throws ToroException
Gets the stream of a file that's on a virtual file system.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': ''accesskey': 'your-access-key'']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def inputStream = 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream( [ssl:"false", passive:"true"])
Example usage in Dropbox:
def inputStream = 'dbx://path/to/foo.txt'.vfsGetInputStream([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def inputStream = 'gdv://path/to/foo.txt'.vfsGetInputStream([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def inputStream = 's3://path/to/foo.txt'.vfsGetInputStream([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
def inputStream = 'od://path/to/foo.txt'.vfsGetInputStream([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
url
- the URL to download the remote file fromproperties
- optional properties for the requestToroException
- if an error occurs during this operationpublic static InputStream vfsGetInputStream(String url) throws ToroException
Gets the stream of a file that's on a virtual file system.
Supported file systems are:
Example usages:
inputStream = 'file://path/to/local-file.txt'.vfsGetInputStream() inputStream = 'http://www.home.com/remote-file.txt'.vfsGetInputStream() inputStream = 'https://www.secure-home.com/remote-file.txt'.vfsGetInputStream() inputStream = 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream() inputStream = 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream() inputStream = 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream()
url
- the URL to download the remote file fromToroException
- if an error occurs during this operationvfsGetInputStream(String, Closure)
,
vfsGetInputStream(String, Map)
,
vfsGetInputStream(String, Map, Closure)
public static void vfsGetInputStream(String url, Map properties, Closure closure) throws ToroException
Executes a closure upon fetching the stream of a file that's on a virtual file system.
The stream will be closed once the closure has finished executing. Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream( [ssl:"false", passive:"true"], inputStream -> Files.copy(${inputStream}, Paths.get('path', 'to', 'target')))
Example usage in Dropbox:
def inputStream = 'dbx://path/to/foo.txt'.vfsGetInputStream([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], inputStream -> Files.copy(${inputStream}, Paths.get('path', 'to', 'target')))
Example usage in Google Drive:
def inputStream = 'gdv://path/to/foo.txt'.vfsGetInputStream([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true], inputStream -> Files.copy(${inputStream}, Paths.get('path', 'to', 'target')))
Example usage in Amazon S3:
def inputStream = 's3://path/to/foo.txt'.vfsGetInputStream([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], inputStream -> Files.copy(${inputStream}, Paths.get('path', 'to', 'target')))
Example usage in OneDrive:
def inputStream = 'od://path/to/foo.txt'.vfsGetInputStream([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], inputStream -> Files.copy(${inputStream}, Paths.get('path', 'to', 'target')))
url
- the URL to download the remote file fromproperties
- optional properties for the requestclosure
- code to execute after fetching the stream; could be null
ToroException
- if an error occurs while fetching the stream; if closure
has more than one
parametervfsGetInputStream(String)
,
vfsGetInputStream(String, Closure)
,
vfsGetInputStream(String, Map)
public static void vfsGetInputStream(String url, Closure closure) throws ToroException
Executes a closure upon fetching the stream of a file that's on a virtual file system.
The stream will be closed once the closure has finished executing. Supported file systems are:
Example usages:
def copy = {inputStream -> Files.copy(${inputStream}, Paths.get('path', 'to', 'target'))} 'file://path/to/local-file.txt'.vfsGetInputStream(copy) 'http://www.home.com/remote-file.txt'.vfsGetInputStream(copy) 'https://www.secure-home.com/remote-file.txt'.vfsGetInputStream(copy) 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream(copy) 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream(copy) 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetInputStream(copy)
url
- the URL to download the remote file fromclosure
- code to execute after fetching the stream; could be null
ToroException
- if an error occurs while fetching the stream; if closure
has more than one
parametervfsGetInputStream(String)
,
vfsGetInputStream(String, Map)
,
vfsGetInputStream(String, Map, Closure)
public static byte[] vfsGetBytes(String url) throws ToroException
Gets the byte array content of a file that's on a virtual file system.
Supported file systems are:
Example usages:
bytes = 'file://path/to/local-file.txt'.vfsGetBytes() bytes = 'http://www.home.com/remote-file.txt'.vfsGetBytes() bytes = 'https://www.secure-home.com/remote-file.txt'.vfsGetBytes() bytes = 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetBytes() bytes = 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetBytes() bytes = 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetBytes()
url
- the URL to download the remote file fromToroException
- if an error occurs during this operationpublic static byte[] vfsGetBytes(String url, Map properties) throws ToroException
Gets the stream of a file that's on a virtual file system.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def bytes = 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetBytes( [ssl:"false", passive:"true"])
Example usage in Dropbox:
def bytes = 'dbx://path/to/foo.txt'.vfsGetBytes([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def bytes = 'gdv://path/to/foo.txt'.vfsGetBytes([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def bytes = 's3://path/to/foo.txt'.vfsGetBytes([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
def bytes = 'od://path/to/foo.txt'.vfsGetBytes([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
url
- the URL to download the remote file fromproperties
- optional properties for the requestToroException
- if an error occurs during this operationpublic static File vfsGetFile(String url, String filename) throws ToroException, IOException
Gets the content of a file that's on a virtual file system and writes it to the given file.
Supported file systems are:
Example usages:
'file://path/to/local-file.txt'.vfsGetFile( '/tmp/data.txt' ) 'http://www.home.com/remote-file.txt'.vfsGetFile( '/tmp/data.txt' ) 'https://www.secure-home.com/remote-file.txt'.vfsGetFile( '/tmp/data.txt' ) 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetFile( '/tmp/data.txt' ) 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetFile( '/tmp/data.txt' ) 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetFile( '/tmp/data.txt' )
url
- the URL to download the remote file fromToroException
- if an error occurs during this operationIOException
public static File vfsGetFile(String url, String filename, Map properties) throws ToroException, IOException
Writes a file from a virtual file system to the local file system.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def bytes = 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.vfsGetBytes( [ssl:"false", passive:"true"])
Example usage in Dropbox:
def bytes = 'dbx://path/to/foo.txt'.vfsGetFile( '/tmp/hello.txt',[ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def bytes = 'gdv://path/to/foo.txt'.vfsGetFile( '/tmp/hello.txt',[ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def bytes = 's3://path/to/foo.txt'.vfsGetFile( '/tmp/hello.txt',[ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
File f = 'od://path/to/foo.txt'.vfsGetFile( '/tmp/hello.txt',[ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
url
- the URL to download the remote file fromfilename
- the name of the file to write the data toproperties
- optional properties for the requestToroException
- if an error occurs during this operationIOException
public static org.apache.commons.vfs2.FileObject file(String url) throws ToroException
Gets the FileObject
of a file that's on a virtual file system.
Supported file systems are:
Example usages:
file = 'file://path/to/local-file.txt'.file() file = 'http://www.home.com/remote-file.txt'.file() file = 'https://www.secure-home.com/remote-file.txt'.file() file = 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.file() file = 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.file() file = 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.file()
url
- the URL to download the remote file fromToroException
- if an error occurs during this operationpublic static org.apache.commons.vfs2.FileObject file(String url, Map properties) throws ToroException
Gets the FileObject
of a file that's on a virtual file system.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def file = 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.file([ssl:"false", passive:"true"])
Example usage in Dropbox:
def file = 'dbx://path/to/foo.txt'.file([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def file = 'gdv://path/to/foo.txt'.file([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def file = 's3://path/to/foo.txt'.file([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
def file = 'od://path/to/foo.txt'.file([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
url
- the URL to download the remote file fromproperties
- optional properties for the requestToroException
- if an error occurs during this operationpublic static void send(String url, Map properties, Reader data, List<DataSource> attachment) throws ToroException, IOException
Sends bytes of data to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send( [ssl:"false", passive:"true"], 'The quick brown fox jumps over the lazy dog.'.bytes(), null)
Example usage in Dropbox:
'dbx://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], 'The quick brown fox jumps over the lazy dog.'.bytes(), null)
Example usage in Google Drive:
'gdv://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry: true'], 'The quick brown fox jumps over the lazy dog.'.bytes(), null)
Example usage in Amazon S3:
's3://path/to/foo.txt'.send([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], 'The quick brown fox jumps over the lazy dog'.bytes(), null)
Example usage in OneDrive:
'od://path/to/foo.txt'.send([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], 'the quick brown fox jumps over the lazy dog'.bytes(), null)
For sending emails, the properties map must contain a to value. cc and bcc are optional.
def emailBody = ... def emailAttachments = ... 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send( [to: 'friend@gmail.com'], emailBody, emailAttachments);
url
- the URL to download the remote file fromproperties
- optional properties for the request, must contain a 'to' valuedata
- the data to send (if data is to be sent to an email, this is the body of the email)attachment
- email attachments; only used if data is to be sent via email, should be null
otherwiseToroException
- if url
is empty; if data
is empty; if an email is to be sent but the
to
property is empty; or if any other error occurs during this operationIOException
send(String, byte[])
,
sendTo(byte[], String)
public static byte[] send(String url, byte[] data) throws ToroException, IOException
Sends bytes of data to a remote location.
Supported file systems are:
Example usages:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() 'file://path/to/local-file.txt'.send(content) 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(content) 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.send(content) 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(content)
url
- the URL to send the data todata
- the data to sendToroException
- if url
is empty; if data
is empty; if an email is to be sent but the
to
property is empty; or if any other error occurs during this operationIOException
sendTo(String, Map, byte[])
public static byte[] send(String url, byte[] data, Map properties) throws ToroException, IOException
Sends bytes of data to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(content, [ssl:"false", passive:"true"])
Example usage in Dropbox:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() 'dbx://path/to/foo.txt'.send(content, [ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() 'gdv://path/to/foo.txt'.send(content, [ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() 's3://path/to/foo.txt'.send(content, [ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() 'od://path/to/foo.txt'.send(content, [ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
For sending emails:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send( content, [to: 'friend@gmail.com']);
url
- the URL to send the data todata
- the data to sendproperties
- optional properties for the request, must contain a 'to' valueToroException
- if url
is empty; if data
is empty; if an email is to be sent but the
to
property is empty; or if any other error occurs during this operationIOException
public static String send(String url, Map properties, String data) throws ToroException, IOException
Sends string to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send( [ssl:"false", passive:"true"], 'The quick brown fox jumps over the lazy dog.')
Example usage in Dropbox:
'dbx://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], 'The quick brown fox jumps over the lazy dog.')
Example usage in Google Drive:
'gdv://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true], 'The quick brown fox jumps over the lazy dog.')
Example usage in Amazon S3:
's3://path/to/foo.txt'.send([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], 'The quick brown fox jumps over the lazy dog')
Example usage in OneDrive:
'od://path/to/foo.txt'.send([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], 'The quick brown fox jumps over the lazy dog')
For sending emails:
'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send( [to: 'friend@gmail.com'], 'The quick brown fox jumps over the lazy dog.');
url
- the URL to send the data todata
- the data to send (if data is to be sent to an email, this is the body of the email)properties
- optional properties for the request; could be nullToroException
- if url
is empty; if data
is empty; if an email is to be sent but the to
property is empty; or if any other error occurs during this operationIOException
send(String, String)
public static String send(String url, Map properties, String data, List<DataSource> attachment) throws ToroException, IOException
Sends string to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send( [ssl:"false", passive:"true"], 'The quick brown fox jumps over the lazy dog.', null)
Example usage in Dropbox:
'dbx://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], 'The quick brown fox jumps over the lazy dog.', null)
Example usage in Google Drive:
'gdv://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true], 'The quick brown fox jumps over the lazy dog.', null)
Example usage in Amazon S3:
's3://path/to/foo.txt'.send([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], 'The quick brown fox jumps over the lazy dog', null)
Example usage in OneDrive:
'od://path/to/foo.txt'.send([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], 'The quick brown fox jumps over the lazy dog', null)
For sending emails:
def emailBody = ... def emailAttachments = ... 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send( [to: 'friend@gmail.com'], emailBody, emailAttachments);
url
- the URL to send the data todata
- the data to send (if data is to be sent to an email, this is the body of the email)properties
- optional properties for the request; could be nullattachment
- email attachments; only used if data is to be sent via email, should be null otherwiseToroException
- if url
is empty; if data
is empty; if an email is to be sent but the
to
property is empty; or if any other error occurs during this operationIOException
send(String, String)
,
send(String, Map, String)
public static String send(String url, String data) throws ToroException, IOException
Sends string to a remote location.
Supported file systems are:
Example usages:
'file://path/to/local-file.txt'.send('The quick brown fox jumps over the lazy dog.') 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send('The quick brown fox jumps over the lazy dog.') 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.send('The quick brown fox jumps over the lazy dog.') 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.send('The quick brown fox jumps over the lazy dog.')
url
- the URL to send the data todata
- the data to sendToroException
- if data
is empty; if url
is empty; or if any other error occurs during this
operationIOException
send(String, Map, String)
,
sendTo(String, String, Map)
public static File send(String url, Map properties, File file) throws ToroException
Sends a file to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def file = ... 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send([ssl:"false", passive:"true"], file)
Example usage in Dropbox:
def file = ... 'dbx://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], file)
Example usage in Google Drive:
def file = ... 'gdv://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true], file)
Example usage in Amazon S3:
def file = ... 's3://path/to/foo.txt'.send([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], file)
Example usage in OneDrive:
def file = ... 'od://path/to/foo.txt'.send([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], file)
For sending emails:
def file = ... 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send([to: 'friend@gmail.com'], file);
url
- the URL to send the data toproperties
- optional properties for the request; could be nullfile
- the data to send (if data is to be sent to an email, this is the body of the email)ToroException
- if url
is empty; if file is empty, if an email is to be sent but the to
property is empty; or if any other error occurs during this operationpublic static File send(String url, File file) throws ToroException
Sends a file to a remote location.
Supported file systems are:
Example usages:
def file = ... 'file://path/to/local-file.txt'.send(file) 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(file) 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.send(file) 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(file)
url
- the URL to send the file tofile
- the file to sendToroException
- if url
is empty; if file
ends up having no data, or if any other
error occurs during this operationpublic static void send(String url, Map properties, InputStream is) throws ToroException
Sends a stream to a remote location.
The stream is closed after this operation. Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def inputStream = ... 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send( [ssl:"false", passive:"true"], inputStream)
Example usage in Dropbox:
def inputStream = ... 'dbx://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], inputStream)
Example usage in Google Drive:
def inputStream = ... 'gdv://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true], inputStream)
Example usage in Amazon S3:
def inputStream = ... 's3://path/to/foo.txt'.send([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], inputStream)
Example usage in OneDrive:
def inputStream = ... 'od://path/to/foo.txt'.send([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], inputStream)
For sending emails:
def inputStream = ... 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send( [to: 'friend@gmail.com'], inputStream);
url
- the URL to send the stream tois
- the data to send (if data is to be sent to an email, this is the body of the email)properties
- optional properties for the request; could be nullToroException
- if url
is empty; if is
turns out to be empty; if an email is to be
sent but the to
property is empty; or if any other error occurs during this
operationpublic static void send(String url, InputStream is) throws ToroException
Sends stream to a remote location.
The stream is closed after this operation. Supported file systems are:
Example usages:
def inputStream = ... 'file://path/to/local-file.txt'.send(inputStream) 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(inputStream) 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.send(inputStream) 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(inputStream)
url
- the URL to send the data tois
- the stream to sendToroException
- if url
is empty; if is
is turns out to be empty; or if any other error
occurs during this operationpublic static void send(String url, Map properties, Reader reader) throws ToroException
Sends the contents of a reader to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def inputStream = ... 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send( [ssl:"false", passive:"true"], inputStream)
Example usage in Dropbox:
def reader = ... 'dbx://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], reader)
Example usage in Google Drive:
def reader = ... 'gdv://path/to/foo.txt'.send([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true], reader)
Example usage in Amazon S3:
def reader = ... 's3://path/to/foo.txt'.send([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], reader)
Example usage in OneDrive:
def reader = ... 'od://path/to/foo.txt'.send([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], reader)
For sending emails:
def reader = ... 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send( [to: 'friend@gmail.com'], reader);
url
- the URL to send the stream toreader
- contains the data to be sent (if data is to be sent to an email, this is the body of the email)properties
- optional properties for the request; could be nullToroException
- if url
is empty; if reader
turns out to be empty; if an email is to
be sent but the to
property is empty; or if any other error occurs during this
operationpublic static void send(String url, Reader reader) throws ToroException
Sends the contents of a reader to a remote location.
Supported file systems are:
Example usages:
def reader = ... 'file://path/to/local-file.txt'.send(reader) 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(reader) 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.send(reader) 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(reader)
url
- the URL to send the data toreader
- contains the data to be sentToroException
- if url
is empty; if reader
turns out to be empty; or if any other
error occurs during this operationpublic static byte[] sendTo(String url, Map properties, byte[] data) throws ToroException, IOException
Sends bytes of data to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send( [ssl:"false", passive:"true"], 'The quick brown fox jumps over the lazy dog.'.bytes())
Example usage in Dropbox:
'dbx://path/to/foo.txt'.sendTo([ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5], 'The quick brown fox jumps over the lazy dog.'.bytes())
Example usage in Google Drive:
'gdv://path/to/foo.txt'.sendTo([ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true], 'The quick brown fox jumps over the lazy dog.'.bytes())
Example usage in Amazon S3:
's3://path/to/foo.txt'.sendTo([ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'], 'The quick brown fox jumps over the lazy dog'.bytes())
Example usage in OneDrive:
'od://path/to/foo.txt'.sendTo([ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'], 'The quick brown fox jumps over the lazy dog'.bytes())
For sending emails:
'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.sendTo( [to: 'friend@gmail.com'], 'The quick brown fox jumps over the lazy dog.'.bytes());
url
- the URL to download the remote file fromproperties
- optional properties for the request; could be nulldata
- the data to send (if data is to be sent to an email, this is the body of the email)ToroException
- if url
is empty; if data
is empty; if an email is to be sent but the
to
property is empty; or if any other error occurs during this operationIOException
send(String, byte[])
,
sendTo(String, Map, byte[])
public static byte[] sendTo(byte[] data, String url) throws ToroException, IOException
Sends bytes of data to a remote location.
Supported file systems are:
Example usages:
def content = 'The quick brown fox jumps over the lazy dog.'.bytes() content.sendTo('file://path/to/local-file.txt') content.sendTo('ftp://login:password@127.0.0.1/home/login/remote-file.txt') content.sendTo('ftps://login:password@127.0.0.1/home/login/remote-file.txt') content.sendTo('sftp://login:password@127.0.0.1/home/login/remote-file.txt') content.sendTo('smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report');
data
- the data to sendurl
- the URL to send the data toToroException
- if url
is empty; if data
is empty; if an email is to be sent but the
to
property is empty; or if any other error occurs during this operationIOException
send(String, byte[])
public static String sendTo(String data, String url, Map properties) throws ToroException
Sends string to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
'The quick brown fox jumps over the lazy dog.'.sendTo( 'ftp://login:password@127.0.0.1/home/login/remote-file.txt', [ssl:"false", passive:"true"])
Example usage in Dropbox:
'The quick brown fox jumps over the lazy dog.'.sendTo('dbx://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
'The quick brown fox jumps over the lazy dog.'.sendTo('gdv://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
'The quick brown fox jumps over the lazy dog'.send('s3://path/to/foo.txt', [ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
'The quick brown fox jumps over the lazy dog'.send('od://path/to/foo.txt',[ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
For sending emails:
'The quick brown fox jumps over the lazy dog.'.sendTo( 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report', [to: 'friend@gmail.com']);
data
- the data to send (if data is to be sent to an email, this is the body of the email)url
- the URL to send the data toproperties
- optional properties for the request; could be nullToroException
- if data
is empty; if url
is empty; if an email is to be sent but the
to
property is empty; or if any other error occurs during this operationsendTo(String, String)
,
send(String, Map, String)
public static String sendTo(String data, String url) throws ToroException
Sends string to a remote location.
Supported file systems are:
Example usages:
'The quick brown fox jumped.'.sendTo('file://path/to/local-file.txt') 'The quick brown fox jumped.'.sendTo('ftp://login:password@127.0.0.1/home/login/remote-file.txt') 'The quick brown fox jumped.'.sendTo('ftps://login:password@127.0.0.1/home/login/remote-file.txt') 'The quick brown fox jumped.'.sendTo('sftp://login:password@127.0.0.1/home/login/remote-file.txt')
data
- the data to sendurl
- the URL to send the data toToroException
- if data
is empty;
if url
is empty; or if any other error occurs during this operationsend(String, String)
,
sendTo(String, String, Map)
public static File sendTo(File file, String url, Map properties) throws ToroException
Sends a file to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def file = ... file.sendTo('ftp://login:password@127.0.0.1/home/login/remote-file.txt', [ssl:"false", passive:"true"])
Example usage in Dropbox:
def file = ... file.sendTo('dbx://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def file = ... file.sendTo('gdv://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def file = ... file.sendTo('s3://path/to/foo.txt',[ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
def file = ... file.sendTo('od://path/to/foo.txt', [ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
For sending emails:
def file = ... file.sendTo('smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report', [to: 'friend@gmail.com'])
file
- the data to send (if data is to be sent to an email, this is the body of the email)url
- the URL to send the data toproperties
- optional properties for the request; could be nullToroException
- if url
is empty; if file
is empty, if an email is to be sent but the to
property is empty; or if any other error occurs during this operationpublic static File sendTo(File file, String url) throws ToroException
Sends a file to a remote location.
Supported file systems are:
Example usages:
def file = ... 'file://path/to/local-file.txt'.vfsGetBytes(file) 'ftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(file) 'ftps://login:password@127.0.0.1/home/login/remote-file.txt'.send(file) 'sftp://login:password@127.0.0.1/home/login/remote-file.txt'.send(file)
file
- the file to sendurl
- the URL to send the file toToroException
- if url
is empty; if file
ends up having no data, or if any other
error occurs during this operationpublic static void sendTo(InputStream is, String url, Map properties) throws ToroException
Sends a stream to a remote location.
The stream is closed after this operation. Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def inputStream = ... inputStream.sendTo('ftp://login:password@127.0.0.1/home/login/remote-file.txt', [ssl:"false", passive:"true"])
Example usage in Dropbox:
def inputStream = ... inputStream.sendTo('dbx://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def inputStream = ... inputStream.sendTo('gdv://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def inputStream = ... inputStream.sendTo('s3://path/to/foo.txt',[ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
def inputStream = ... inputStream.sendTo('od://path/to/foo.txt', [ 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
For sending emails:
def inputStream = ... inputStream.sendTo( 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report', [to: 'friend@gmail.com']);
is
- the data to send (if data is to be sent to an email, this is the body of the email)url
- the URL to send the stream toproperties
- optional properties for the request; could be nullToroException
- if url
is empty; if is
turns out to be empty; if an email is to be
sent but the to
property is empty; or if any other error occurs during this
operationpublic static void sendTo(InputStream is, String url) throws ToroException
Sends stream to a remote location.
The stream is closed after this operation. Supported file systems are:
Example usages:
def inputStream = ... inputStream.sendTo('file://path/to/local-file.txt') inputStream.sendTo('ftp://login:password@127.0.0.1/home/login/remote-file.txt') inputStream.sendTo('ftps://login:password@127.0.0.1/home/login/remote-file.txt') inputStream.sendTo('sftp://login:password@127.0.0.1/home/login/remote-file.txt')
is
- the stream to sendurl
- the URL to send the data toToroException
- if url
is empty; if is
is turns out to be empty; or if any other error
occurs during this operationpublic static void sendTo(Reader reader, String url, Map properties) throws ToroException
Sends the contents of a reader to a remote location.
Supported file systems are:
The possible entries in the properties
map varies depending on the target virtual file system. But in
general, for requests that need an access token, the following maps are accepted:
['credential': ['accessToken': 'your-access-token']] ['credential': new OauthTokenAuthenticator('your-access-token')]
And if a username and password must be specified, the user can use a map like:
['credential': ['username': 'your-user-name', 'password': 'your-password', 'domain':'www.your-domain.com']]
Example usage in FTP:
def reader = ... reader.sendTo('ftp://login:password@127.0.0.1/home/login/remote-file.txt', [ssl:"false", passive:"true"])
Example usage in Dropbox:
def reader = ... reader.sendTo('dbx://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'accessToken': 'your-access-token', 'userLocale': Locale.getDefault(), 'autoRetry': true, 'maxRetries': 5])
Example usage in Google Drive:
def reader = ... reader.sendTo('gdv://path/to/foo.txt', [ 'applicationName': 'ApplicationName/Version', 'clientId': 'your-client-id', 'clientSecret': 'your-client-secret', 'refreshToken': 'your-refresh-token', 'accessToken': 'your-access-token', 'autoRetry': true])
Example usage in Amazon S3:
def reader = ... reader.sendTo('s3://path/to/foo.txt', [ 'accesskey': 'your-access-key', 'secretkey': 'your-secret-key', 'region': 'your-region', 'bucketName': 'your-bucket-name'])
Example usage in OneDrive:
reader.sendTo(['od://path/to/foo.txt', 'accessToken': 'your-access-token', 'refreshToken': 'your-refresh-token', 'clientId': 'your-clientId', 'clientSecret': 'your-clientSecret', 'redirectUri': 'your-redirect-uri'])
For sending emails:
def reader = ... reader.sendTo( 'smtp://user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report', [to: 'friend@gmail.com']);
reader
- contains the data to be sent (if data is to be sent to an email, this is the body of the email)url
- the URL to send the stream toproperties
- optional properties for the request; could be nullToroException
- if url
is empty; if reader
turns out to be empty; if an email is to
be sent but the to
property is empty; or if any other error occurs during this
operationpublic static void sendTo(Reader reader, String url) throws ToroException
Sends the contents of a reader to a remote location.
Supported file systems are:
Example usages:
def reader = ... reader.sendTo('file://path/to/local-file.txt') reader.sendTo('ftp://login:password@127.0.0.1/home/login/remote-file.txt') reader.sendTo('ftps://login:password@127.0.0.1/home/login/remote-file.txt') reader.sendTo('sftp://login:password@127.0.0.1/home/login/remote-file.txt')
url
- the URL to send the data toreader
- contains the data to be sentToroException
- if url
is empty; if reader
turns out to be empty; or if any other
error occurs during this operationpublic static Message[] receive(String url, boolean delete) throws ToroException
Retrieve an array of unused email messages.
Example usage:
def messages = 'imaps://$username:$password@imap.gmail.com:$port/$folder'.receive()
url
- the email URL to retrieve the messages fromdelete
- if set to true, deletes read messagesToroException
- if any error occurs during this operationpublic static Message[] receive(String url) throws ToroException
Retrieve an array of unread email messages.
Example usage:
def messages = 'imaps://$username:$password@imap.gmail.com:$port/$folder'.receive()
url
- the email URL to retrieve the messages fromToroException
- if any error occurs during this operationpublic static String copyTo(String sourceUrl, String targetUrl) throws ToroException
Copy the item found in the source url to the target url.
Supported file systems are:
Example usage:
'file://path/to/source-file.txt'.copyTo(ftp://login:password@127.0.0.1/path/to/target-file.txt')
sourceUrl
- the url of the data to copytargetUrl
- the destination of the data to be copiedToroException
- if any error occurs during this operationpublic static void vfsPut(String url, String data) throws ToroException, IOException
send(String, String)
.ToroException
IOException
public static void vfsPut(String url, String data, Map properties) throws ToroException, IOException
send(String, Map, String)
.ToroException
IOException
public static void vfsPut(String url, byte[] data) throws ToroException, IOException
send(String, byte[])
.ToroException
IOException
public static void vfsPut(String url, byte[] data, Map properties) throws ToroException, IOException
#send(String, byte[], Map
.ToroException
IOException
public static void vfsPut(String url, InputStream data) throws ToroException, IOException
#send(String, InputStream
.ToroException
IOException
public static void vfsPut(String url, InputStream data, Map properties) throws ToroException, IOException
send(String, Map, InputStream)
.ToroException
IOException
@GloopObjectParameter(value="output{\nvfsFile#io.toro.martini.vfs.VfsFile{\n}\n}") public static GloopModel getVfsFile(@GloopParameter(allowNull=false) String url, @GloopObjectParameter(value="vfsFileSystemOptions#io.toro.martini.vfs.VfsFileSystemOptions{\n}") GloopModel vfsFileSystemOptions, GloopExecutionContext context) throws ToroException
Gets the FileObject
of a file that's on a virtual file system.
url
- the URL to download the remote file fromvfsFileSystemOptions
- optional properties for the requestcontext
- the Gloop execution context (automatically mapped by Gloop)FileObject
of a file that's on a virtual file systemToroException
- if an error occurs during this operationpublic static void close(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
FileObject
.fileObject
- the FileObject
to closeorg.apache.commons.vfs2.FileSystemException
- on error closing the filepublic static void createFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
fileObject
- the file to createorg.apache.commons.vfs2.FileSystemException
- if the file already exists with the wrong type;
if the parent folder is read-only; or
on error creating this file or one of its ancestorspublic static void createFolder(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
fileObject
- the folder to createorg.apache.commons.vfs2.FileSystemException
- if the folder already exists with the wrong type;
if the parent folder is read-only;
on error creating this folder or one of its ancestorspublic static boolean delete(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
fileObject
- the file to deleteorg.apache.commons.vfs2.FileSystemException
- if this file is a non-empty folder;
if this file is read-only; or
on error deleting this filepublic static void deleteAll(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
fileObject
- the file to deleteorg.apache.commons.vfs2.FileSystemException
- if an error occurspublic static boolean exists(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
fileObject
- the file to checkorg.apache.commons.vfs2.FileSystemException
- on error determining if file exists@GloopObjectParameter(value="output{\nvfsFile#io.toro.martini.vfs.VfsFile{\n}\n}") public static GloopModel getChild(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject, @GloopParameter(allowNull=false) String name) throws org.apache.commons.vfs2.FileSystemException
FileObject
of the provided FileObject
.
The child file is searched by name.fileObject
- where to look for the child filename
- the name of the child fileorg.apache.commons.vfs2.FileSystemException
- if this file does not exist, or is not a folder; or
on error determining this file's children@GloopObjectParameter(value="output{\nvfsFiles#io.toro.martini.vfs.VfsFile[]{\n}\n}") public static GloopModel getChildren(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
FileObject
.
The result is usually a listing of directories and files in a directory.fileObject
- the file whose children will be retrievedfileObject
org.apache.commons.vfs2.FileSystemException
- if this file does not exist, or is not a folder; or
on error listing this file's children@GloopObjectParameter(value="output{\nvfsContent#io.toro.martini.vfs.VfsContent{\n}\n}") public static GloopModel getContent(org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
FileObject
.fileObject
- the fileorg.apache.commons.vfs2.FileSystemException
- on error getting file content@GloopObjectParameter(value="output{\nvfsName#io.toro.martini.vfs.VfsName{\n}\n}") public static GloopModel getName(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject)
FileObject
.fileObject
- the file@GloopObjectParameter(value="output{\nvfsFile#io.toro.martini.vfs.VfsFile{\n}\n}") public static GloopModel getParent(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
FileObject
.fileObject
- the fileorg.apache.commons.vfs2.FileSystemException
- on error finding parent filepublic static void refresh(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject) throws org.apache.commons.vfs2.FileSystemException
fileObject
- file to synchronizeorg.apache.commons.vfs2.FileSystemException
@GloopObjectParameter(value="output{\nvfsFile#io.toro.martini.vfs.VfsFile{\n}\n}") public static GloopModel resolveFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject fileObject, @GloopParameter(allowNull=false) String path) throws org.apache.commons.vfs2.FileSystemException
FileObject
.fileObject
- the file objectpath
- the path of the file to locate within fileObject
org.apache.commons.vfs2.FileSystemException
- on error parsing the path;
on error finding the filepublic static void setExecutable(org.apache.commons.vfs2.FileObject fileObject, @GloopParameter(defaultValue="false") boolean executable, @GloopParameter(defaultValue="false") boolean ownerOnly) throws org.apache.commons.vfs2.FileSystemException
FileObject
.fileObject
- the fileexecutable
- set to true to allow read access, false to disallowownerOnly
- if true, the permission applies only to the owner; otherwise, it applies to everybodyorg.apache.commons.vfs2.FileSystemException
- on error determining if file existspublic static void setReadable(org.apache.commons.vfs2.FileObject fileObject, @GloopParameter(defaultValue="false") boolean readable, @GloopParameter(defaultValue="false") boolean ownerOnly) throws org.apache.commons.vfs2.FileSystemException
FileObject
.fileObject
- the filereadable
- true to allow read access, false to disallowownerOnly
- if true, the permission applies only to the owner; otherwise, it applies to everybodyorg.apache.commons.vfs2.FileSystemException
- on error determining if file existspublic static void setWritable(org.apache.commons.vfs2.FileObject fileObject, @GloopParameter(defaultValue="false") boolean writable, @GloopParameter(defaultValue="false") boolean ownerOnly) throws org.apache.commons.vfs2.FileSystemException
FileObject
.fileObject
- the filewritable
- true to allow read access, false to disallowownerOnly
- if true, the permission applies only to the owner; otherwise, it applies to everybodyorg.apache.commons.vfs2.FileSystemException
- on error determining if file existspublic static Object getAttribute(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) String attrName) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the fileattrName
- the name of the attribute to retrieveorg.apache.commons.vfs2.FileSystemException
- if file does not exist;
if file does not support attributespublic static String[] getAttributeNames(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the fileorg.apache.commons.vfs2.FileSystemException
- if file does not exist;
if file does not support attributes@GloopObjectParameter(value="output{\nvfsFile#io.toro.martini.vfs.VfsFile{\n}\n}") public static GloopModel getFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileObject)
FileObject
to which the provided FileContent
belongs tofileObject
- the contentpublic static InputStream getInputStream(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentorg.apache.commons.vfs2.FileSystemException
- if the file does not exist;
if file is being read, or is being written; or
on error opening the streampublic static long getLastModifiedTime(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file content to checkorg.apache.commons.vfs2.FileSystemException
- if the file does not exist;
if file is being written to; or
on error determining the last-modified timestamppublic static OutputStream getOutputStream(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentorg.apache.commons.vfs2.FileSystemException
- if the file is read-only;
if the file is being read, or is being written; or
on error opening the streampublic static long getSize(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentorg.apache.commons.vfs2.FileSystemException
- if the file does not exist;
if file is being written to; or
on error determining the sizepublic static boolean hasAttribute(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) String attributeName) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentattributeName
- the name of the attribute to checkorg.apache.commons.vfs2.FileSystemException
- if the file does not exist, or does not support attributes.public static boolean isOpen(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentorg.apache.commons.vfs2.FileSystemException
public static void removeAttribute(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) String attributeName) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentattributeName
- the name of the attribute to removeorg.apache.commons.vfs2.FileSystemException
- if the file does not exist;
if file is read-only;
if file does not support attributes; or
on error removing the attributepublic static void setAttribute(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) String attributeName, @GloopParameter(allowNull=false) Object value) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentattributeName
- the name of the attributevalue
- the new value of the attributeorg.apache.commons.vfs2.FileSystemException
- if the file does not exist;
if file is read-only;
if file does not support attributes; or
on error setting the attributepublic static void setLastModifiedTime(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) long lastModifiedTime) throws org.apache.commons.vfs2.FileSystemException
fileContent
- the file contentlastModifiedTime
- the new last modified timeorg.apache.commons.vfs2.FileSystemException
- if the file is read-only;
is being written to;
or on error setting the last-modified timestamppublic static void readFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent targetContent) throws IOException
fileContent
, writing it to targetContent
.fileContent
- the source file contenttargetContent
- the destination file contentIOException
public static void readFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) org.apache.commons.vfs2.FileObject targetObject) throws IOException
fileContent
, writing it to targetObject
.fileContent
- the source file contenttargetObject
- the destination fileIOException
public static void readFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) OutputStream outputStream, @GloopParameter(allowNull=false,defaultValue="1024") int bufferSize) throws IOException
fileContent
, writing it to outputStream
.fileContent
- the source file contentoutputStream
- destination output streambufferSize
- buffer size to write data in chunksIOException
public static String readFileAsString(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false,defaultValue="1024") int bufferSize) throws IOException
fileContent
- source file contentbufferSize
- buffer size to write data in chunksIOException
public static byte[] readFileAsBytes(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false,defaultValue="1024") int bufferSize) throws IOException
fileContent
- source file contentbufferSize
- buffer size to write data in chunksIOException
public static void writeFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) InputStream inputStream, @GloopParameter(defaultValue="false") boolean append, @GloopParameter(allowNull=false,defaultValue="1024") int bufferSize) throws IOException
fileContent
.fileContent
- where the data will be writteninputStream
- contains the data to be writtenappend
- whether or not to append the data in the stream to the current file contentbufferSize
- the buffer size used when writing inputStream
to fileContent
IOException
public static void writeFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) InputStream inputStream, @GloopParameter(defaultValue="false") boolean append) throws IOException
fileContent
, with a buffer size of 4096
.fileContent
- where the data will be writteninputStream
- contains the data to be writtenappend
- whether or not to append the data in the stream to the current file contentIOException
public static void writeFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) String data, @GloopParameter(defaultValue="false") boolean append, @GloopParameter(allowNull=false,defaultValue="1024") int bufferSize) throws IOException
fileContent
- where the data will be writtendata
- the data to be writtenappend
- whether or not to append the data in the stream to the current file contentIOException
public static void writeFile(@GloopParameter(allowNull=false) org.apache.commons.vfs2.FileContent fileContent, @GloopParameter(allowNull=false) byte[] data, @GloopParameter(defaultValue="false") boolean append, @GloopParameter(allowNull=false,defaultValue="1024") int bufferSize) throws IOException
fileContent
- where the data will be writtendata
- the data to be writtenappend
- whether or not to append the data in the stream to the current file contentIOException
Copyright © 2023. All rights reserved.