jet.server.api
Interface RemoteFileService


public interface RemoteFileService

RemoteFileService is an interface that is used to help you access files on the remote machine.


Method Summary
 void copyFromRemote(java.lang.String remoteFilename, java.lang.String localFilename)
          Copies the remote file denoted by string remoteFilename to the local machine, including subfolders.
 void copyFromRemote(java.lang.String remoteFilename, java.lang.String localFilename, boolean withSubFolder)
          Copies the remote file denoted by string remoteFilename to the local machine.
 void copyToRemote(java.lang.String localFilename, java.lang.String remoteFilename)
          Copies the local file denoted by string localFilename to the remote machine, including subfolders.
 void copyToRemote(java.lang.String localFilename, java.lang.String remoteFilename, boolean withSubFolder)
          Copies the local file denoted by string localFilename to the remote machine.
 boolean delete(java.lang.String remoteFilename)
          Deletes the file or directory denoted by this string remoteFilename.
 boolean exists(java.lang.String remoteFilename)
          Tests whether a specificed file or folder denoted by String remoteFilename exists on the remote machine.
 java.lang.String getName(java.lang.String remoteFilename)
          Returns the name of the file or directory denoted by this pathname.
 java.lang.String getParent(java.lang.String remoteFilename)
          Returns the pathname string of this pathname's parent, or null if this pathname does not name a parent directory.
 java.lang.String getRemoteFileSeparator()
          Return the system-dependent path-separator character, represented as a string for convenience.
 java.lang.String getRemoteHomePath()
          Get the home path of the remote server.
 boolean isDirectory(java.lang.String remoteFilename)
          Tests whether the file denoted by this abstract pathname is a directory.
 long lastModified(java.lang.String remoteFilename)
          Returns the time that the file denoted by this abstract pathname was last modified.
 long length(java.lang.String remoteFilename)
          Returns the length of the file denoted by this abstract pathname.
 java.lang.String[] list(java.lang.String remoteDirName, java.lang.String filter)
          Returns an array of strings naming the files and directories in the directory denoted by this string remoteDirName.
 java.io.InputStream readFile(java.lang.String remoteFilename)
          Creates an InputStream by opening a connection to a remote file denoted by remoteFilename.
 void writeFile(java.io.InputStream in, java.lang.String remoteFilename)
          Writes to a specified remote file with this InputStream.
 

Method Detail

readFile

java.io.InputStream readFile(java.lang.String remoteFilename)
                             throws java.io.IOException
Creates an InputStream by opening a connection to a remote file denoted by remoteFilename. If the file denoted by the string remoteFilename does not exist or it is a directory rather than a regular file, or for some other reasons cannot be opened for reading then a FileNotFoundException is thrown.

Parameters:
remoteFilename - the remote file name
Returns:
remote File InputStream
Throws:
java.io.IOException

writeFile

void writeFile(java.io.InputStream in,
               java.lang.String remoteFilename)
               throws java.io.IOException
Writes to a specified remote file with this InputStream. If the file denoted by the string remoteFilename does not exist or it is a directory rather than a regular file, or for some other reason cannot be opened for reading then a FileNotFoundException is thrown.

Parameters:
InputStream - the input file stream
remoteFilename - the remote file name
Throws:
java.io.IOException

copyToRemote

void copyToRemote(java.lang.String localFilename,
                  java.lang.String remoteFilename)
                  throws java.io.IOException
Copies the local file denoted by string localFilename to the remote machine, including subfolders. If the local pathname is a file name, the remote pathname must be a file name, or a folder name end with file separator. If the local pathname is a folder instead of a file, then all the files and subfolders in this folder will be copied to remote folder. In this case the remote pathname must be a folder, too. You can use wildcards '*' and '?' in the local pathname to copy a group of specific files, in this case, the remote pathname must be a folder. For example: you can use copyToRemote("d:\\temp\\local\\*" , "d:\\temp\\remote\\"), or copyToRemote("d:\\temp\\local\\??.txt" , "d:\\temp\\remote\\").

Parameters:
localFilename - the absolute local file name. You can use wildcards in this parameter,
remoteFilename - the absolute remote file name
Throws:
java.io.IOException

copyToRemote

void copyToRemote(java.lang.String localFilename,
                  java.lang.String remoteFilename,
                  boolean withSubFolder)
                  throws java.io.IOException
Copies the local file denoted by string localFilename to the remote machine. If the local pathname is a file name, the remote pathname must be a file name, or a folder name end with file separator. If the local pathname is a folder instead of a file, then all the files in this folder will be copied to remote folder. In this case the remote pathname must be a folder, too. You can use wildcards '*' and '?' in the local pathname to copy a group of specific files, in this case, the remote pathname must be a folder. For example: you can use copyToRemote("d:\\temp\\local\\*" , "d:\\temp\\remote\\"), or copyToRemote("d:\\temp\\local\\??.txt" , "d:\\temp\\remote\\").

Parameters:
localFilename - the absolute local file name. You can use wildcards in this parameter,
remoteFilename - the absolute remote file name
withSubFolder - whether to include subfolders when copying.
Throws:
java.io.IOException

copyFromRemote

void copyFromRemote(java.lang.String remoteFilename,
                    java.lang.String localFilename)
                    throws java.io.IOException
Copies the remote file denoted by string remoteFilename to the local machine, including subfolders. If the remote pathname is a file name, the local pathname must be a file name, or a folder name end with file separator. If the remote pathname is a folder instead of a file, then all the files at this folder will be copied to local folder. In this case the local pathname must be a folder, too. You can use wildcards '*' and '?' in the remote pathname to copy a group of specific files, in this case, the local pathname must be a folder. For example: you can use copyFromRemote("d:\\temp\\remote\\*" , "d:\\temp\\local\\"), or copyFromRemote("d:\\temp\\remote\\??.txt" , "d:\\temp\\local\\").

Parameters:
remoteFilename - the absolute remote file name. You can use wildcards in this parameter,
localFilename - the absolute local file name.
Throws:
java.io.IOException

copyFromRemote

void copyFromRemote(java.lang.String remoteFilename,
                    java.lang.String localFilename,
                    boolean withSubFolder)
                    throws java.io.IOException
Copies the remote file denoted by string remoteFilename to the local machine. If the remote pathname is a file name, the local pathname must be a file name, or a folder name end with file separator. If the remote pathname is a folder instead of a file, then all the files at this folder will be copied to local folder. In this case the local pathname must be a folder, too. You can use wildcards '*' and '?' in the remote pathname to copy a group of specific files, in this case, the local pathname must be a folder. For example: you can use copyFromRemote("d:\\temp\\remote\\*" , "d:\\temp\\local\\"), or copyFromRemote("d:\\temp\\remote\\??.txt" , "d:\\temp\\local\\").

Parameters:
remoteFilename - the absolute remote file name. You can use wildcards in this parameter,
localFilename - the absolute local file name.
withSubFolder - whether to include subfolders when copying.
Throws:
java.io.IOException

delete

boolean delete(java.lang.String remoteFilename)
               throws java.rmi.RemoteException
Deletes the file or directory denoted by this string remoteFilename. If the path name is a directory, then the directory must be empty otherwise it cannot be deleted.

Parameters:
remoteFilename -
Returns:
true if and only if the file or directory is successfully deleted.
Throws:
java.rmi.RemoteException

getRemoteHomePath

java.lang.String getRemoteHomePath()
                                   throws java.rmi.RemoteException
Get the home path of the remote server.

Returns:
the remote server's home path
Throws:
java.rmi.RemoteException

exists

boolean exists(java.lang.String remoteFilename)
               throws java.rmi.RemoteException
Tests whether a specificed file or folder denoted by String remoteFilename exists on the remote machine.

Parameters:
remoteFilename - the remote file name or remote folder name
Returns:
true if and only if the file or folder denoted by this remote pathname exists; false otherwise
Throws:
java.rmi.RemoteException

list

java.lang.String[] list(java.lang.String remoteDirName,
                        java.lang.String filter)
                        throws java.io.IOException
Returns an array of strings naming the files and directories in the directory denoted by this string remoteDirName. If the string remoteDirName does not denote a directory, then this method returns null. Otherwise an array of strings is returned, one for each file or directory in the directory. Each string is a file name other than a complete path.

Parameters:
remoteDirName - the remote directory name
filter - the filter, use '*' for all chars,'?' for single char. It also supports multiple wildcard like "*.com;??.exe".
Returns:
An array of strings naming the files and directories in the directory denoted by this remote pathname. The array will be empty if the directory is empty. Returns null if this remote pathname does not denote a directory, or if an I/O error occurs.
Throws:
java.io.IOException

isDirectory

boolean isDirectory(java.lang.String remoteFilename)
                    throws java.rmi.RemoteException
Tests whether the file denoted by this abstract pathname is a directory.

Returns:
true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise.
Throws:
java.rmi.RemoteException

lastModified

long lastModified(java.lang.String remoteFilename)
                  throws java.rmi.RemoteException
Returns the time that the file denoted by this abstract pathname was last modified.

Returns:
A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs
Throws:
java.rmi.RemoteException

length

long length(java.lang.String remoteFilename)
            throws java.rmi.RemoteException
Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory

Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist.
Throws:
java.rmi.RemoteException

getName

java.lang.String getName(java.lang.String remoteFilename)
                         throws java.rmi.RemoteException
Returns the name of the file or directory denoted by this pathname. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned.

Returns:
The name of the file or directory denoted by this pathname, or the empty string if this pathname's name sequence is empty
Throws:
java.rmi.RemoteException

getParent

java.lang.String getParent(java.lang.String remoteFilename)
                           throws java.rmi.RemoteException
Returns the pathname string of this pathname's parent, or null if this pathname does not name a parent directory. The parent of an pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.

Returns:
The pathname string of the parent directory named by this pathname, or null if this pathname does not name a parent
Throws:
java.rmi.RemoteException

getRemoteFileSeparator

java.lang.String getRemoteFileSeparator()
                                        throws java.rmi.RemoteException
Return the system-dependent path-separator character, represented as a string for convenience. This string contains a single character,

Returns:
string of system-dependent path-separator.
Throws:
java.rmi.RemoteException