Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jet.server.api
Interface RemoteFileService

    public interface RemoteFileService

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

Method Summary
`void` | `copy(java.lang.String remoteSrcPath, java.lang.String remoteDstPath)` Copies the remote file denoted by remoteSrcPath to remoteDstPath.
`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 specified 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 path name.
`java.lang.String` | `getParent(java.lang.String remoteFilename)` Returns the path name string of this path name's parent, or null if this path name does not name a parent directory.
`java.lang.String` | `getRemoteFileSeparator()` Returns the system-dependent path-separator character, represented as a string for convenience.
`java.lang.String` | `getRemoteHomePath()` Gets the home path of the remote server.
`boolean` | `isDirectory(java.lang.String remoteFilename)` Tests whether the file denoted by this abstract path name is a directory.
`long` | `lastModified(java.lang.String remoteFilename)` Returns the time when 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 path name.
`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.
`boolean` | `mkdirs(java.lang.String remotePath)` Creates the directory named by this absolute path, including any necessary but nonexistent parent directories on the remote machine.
`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` - if an I/O error occurs.

### 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` - if an I/O error occurs.

### 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 path name is a file name, the remote path name must be a file name, or a folder name ended with file separator. If the local path name 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 path name must be a folder, too. You can use wildcards '*' and '?' in the local path name to copy a group of specific files, in this case, the remote path name 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` - if an I/O error occurs .

### 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 path name is a file name, the remote pathname must be a file name, or a folder name ended with file separator. If the local path name 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 path name must be a folder, too. You can use wildcards '*' and '?' in the local path name to copy a group of specific files, in this case, the remote path name 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` - if an I/O error occurs.

### 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 path name is a file name, the local path name must be a file name, or a folder name ended with file separator. If the remote path name is a folder instead of a file, then all the files in this folder will be copied to local folder. In this case the local path name must be a folder, too. You can use wildcards '*' and '?' in the remote path name to copy a group of specific files, in this case, the local path name 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` - if an I/O error occurs.

### 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 path name is a file name, the local path name must be a file name, or a folder name ended with file separator. If the remote path name is a folder instead of a file, then all the files in this folder will be copied to local folder. In this case the local path name must be a folder, too. You can use wildcards '*' and '?' in the remote path name to copy a group of specific files, in this case, the local path name 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` - if an I/O error occurs.

### 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, 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` - if communication-related error occurs during RMI call execution.

### getRemoteHomePath

    java.lang.String getRemoteHomePath()
                                       throws java.rmi.RemoteException

  Gets the home path of the remote server.

  Returns:
    the remote server's home path.
  Throws:
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

### exists

    boolean exists(java.lang.String remoteFilename)
                   throws java.rmi.RemoteException

  Tests whether a specified 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, otherwise return false.
  Throws:
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

### 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, using '*' for all chars,'?' for single char. It also supports multiple wildcards like "*.com;??.exe".
  Returns:
    An array of strings naming the files and directories in the directory denoted by this remote path name. 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:
    `IOException.`
    `java.io.IOException`

### isDirectory

    boolean isDirectory(java.lang.String remoteFilename)
                        throws java.rmi.RemoteException

  Tests whether the file denoted by this abstract path name is a directory.

  Returns:
    true if and only if the file denoted by this abstract pathname exists and is a directory, otherwise false.
  Throws:
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

### lastModified

    long lastModified(java.lang.String remoteFilename)
                      throws java.rmi.RemoteException

  Returns the time when the file denoted by this abstract pathname was last modified.

  Returns:
    A long value representing the time when 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` - if communication-related error occurs during RMI call execution.

### length

    long length(java.lang.String remoteFilename)
                throws java.rmi.RemoteException

  Returns the length of the file denoted by this abstract path name. The returned value is unspecified if this path name denotes a directory.

  Returns:
    The length, in bytes, of the file denoted by this abstract path name, or 0L if the file does not exist.
  Throws:
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

### getName

    java.lang.String getName(java.lang.String remoteFilename)
                             throws java.rmi.RemoteException

  Returns the name of the file or directory denoted by this path name. This is just the last name in the path name's name sequence. If the path name's name sequence is empty, then the empty string is returned.

  Returns:
    The name of the file or directory denoted by this path name, or the empty string if this path name's name sequence is empty.
  Throws:
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

### getParent

    java.lang.String getParent(java.lang.String remoteFilename)
                               throws java.rmi.RemoteException

  Returns the path name string of this path name's parent, or null if this path name does not name a parent directory. The parent of a path name consists of the path name's prefix, if any, and all names in the path name's name sequence except for the last. If the name sequence is empty then the path name does not name a parent directory.

  Returns:
    The path name string of the parent directory named by this path name, or null if this path name does not name a parent.
  Throws:
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

### getRemoteFileSeparator

    java.lang.String getRemoteFileSeparator()
                                            throws java.rmi.RemoteException

  Returns the system-dependent path-separator character, represented as a string for convenience. This string contains a single character, on UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\\'.

  Returns:
    string of system-dependent path-separator.
  Throws:
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

### copy

    void copy(java.lang.String remoteSrcPath,
              java.lang.String remoteDstPath)
              throws java.rmi.RemoteException,
                     java.io.IOException

  Copies the remote file denoted by remoteSrcPath to remoteDstPath.

  Parameters:
    `remoteSrcPath` - the absolute remote path name on the resource tree.
    `remoteDstPath` - the absolute remote path name in the disk
  Throws:
    `java.rmi.RemoteException` - if communication-related .error occurs during RMI call execution.
    `java.io.IOException` - if an I/O error occurs.

### mkdirs

    boolean mkdirs(java.lang.String remotePath)
                   throws java.io.IOException,
                          java.rmi.RemoteException

  Creates the directory named by this absolute path, including any necessary but nonexistent parent directories on the remote machine.

  Parameters:
    `remotePath` - the remote path
  Returns:
    `true` if and only if the directory was created, along with all necessary parent directories; `false` otherwise
  Throws:
    `java.io.IOException` - make dirs failed
    `java.rmi.RemoteException` - if communication-related error occurs during RMI call execution.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD