All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.starla.lite.SMBDiskSession

java.lang.Object
   |
   +----com.starla.lite.SMBSession
           |
           +----com.starla.lite.SMBDiskSession

public abstract class SMBDiskSession
extends SMBSession

The SMBDiskSession class provides disk, directory and file related methods on a remote disk share.

The disk session maintains a current working directory, initially set from the PCShare object that was used to open the disk session. Methods such as CreateDirectory (), DeleteDirectory (), OpenFile () etc. will prepend the working directory string to the specified file or directory string, unless the specified file or directory contains a path. The current working directory can be changed using the setWorkingDirectory () method.

A disk session is created using the SMBSessionFactory OpenDiskSession () method. The SMBSessionFactory negotiates the appropriate SMB dialect with the remote server and creates the appropriate SMBDiskSession derived object.


Variable Index

 o Attributes
Set the file attributes, via the setFileInformation () method
 o WriteDate
Set the file write date, via the setFileInformation () method
 o WriteTime
Set the file write time, via the setFileInformation () method

Method Index

 o CloseSession()
Close this connection with the remote server share.
 o CreateDirectory(String)
Createa new directory on the remote file server.
 o DeleteDirectory(String)
Delete the specified directory on the remote file server.
 o DeleteFile(String)
Delete the specified file on the remote file server.
 o DeleteFile(String, int)
Delete the specified file on the remote file server.
 o FileExists(String)
Check if a file exists on the remote file server.
 o getDiskInformation()
Get disk information for this remote disk.
 o getFileInformation(String)
Get file information for the specified file.
 o getWorkingDirectory()
Get the current working directory, relative to the share that is being accessed.
 o isClosed()
Detemine if the disk session has been closed.
 o isDirectory(String)
Check if the specified file name is a directory.
 o OpenFile(String, int)
Open a file on the remote file server.
 o OpenInputStream(String, int)
Open a file as an input stream.
 o OpenOutputStream(String, int)
Open a file as an output stream.
 o RenameFile(String, String)
Rename a file, or set of files, on the remote file server.
 o RenameFile(String, String, int)
Rename a file, or set of files, on the remote file server.
 o setFileInformation(String, SMBFileInfo, int)
Set file information for the specified file.
 o setWorkingDirectory(String)
Set the current working directory, relative to the share that is being accessed.
 o StartSearch(String, int)
Start a search of the specified directory returning information for each file/directory found.

Variables

 o Attributes
 public static final int Attributes
Set the file attributes, via the setFileInformation () method

 o WriteTime
 public static final int WriteTime
Set the file write time, via the setFileInformation () method

 o WriteDate
 public static final int WriteDate
Set the file write date, via the setFileInformation () method

Methods

 o CloseSession
 public abstract void CloseSession() throws IOException
Close this connection with the remote server share.

Throws: IOException
If an I/O error occurs.
Overrides:
CloseSession in class SMBSession
 o CreateDirectory
 public abstract boolean CreateDirectory(String dir) throws IOException
Createa new directory on the remote file server.

Parameters:
dir - Directory name string. If the directory name does not have a leading '\' the current working directory for this session will be prepended to the string.
Returns:
true if the directory was created, else false.
Throws: IOException
If an I/O error occurs.
 o DeleteDirectory
 public abstract boolean DeleteDirectory(String dir) throws IOException
Delete the specified directory on the remote file server.

Parameters:
dir - Directory name string. If the directory name does not have a leading '\' the current working directory for this session will be preprended to the string.
Returns:
true if the directory was deleted, else false.
Throws: IOException
If an I/O error occurs.
 o DeleteFile
 public void DeleteFile(String fname) throws IOException
Delete the specified file on the remote file server.

Parameters:
fname - File name of the remote file to delete. If the file name does not have a leading '\' the current working directory for this session will be prepended to the string. The string may contain wildcard characters to delete multiple files. '?' matches a single character and '*' matches none, one or more characters.
Throws: IOException
If an I/O error occurs.
 o DeleteFile
 public abstract void DeleteFile(String fname,
                                 int attr) throws IOException
Delete the specified file on the remote file server.

Parameters:
fname - File name of the remote file to delete. If the file name does not have a leading '\' the current working directory for this session will be prepended to the string. The string may contain wildcard characters to delete multiple files. '?' matches a single character and '*' matches none, one or more characters.
attr - File attributes of the file(s) to delete.
Throws: IOException
If an I/O error occurs.
 o FileExists
 public boolean FileExists(String fname)
Check if a file exists on the remote file server.

Parameters:
fname - File name to test for on the remote file server. If the file name does not start with a '\' then the working directory is prepended to the file name string.
Returns:
true if the file exists, else false.
 o getDiskInformation
 public abstract SMBDiskInfo getDiskInformation() throws IOException
Get disk information for this remote disk.

Returns:
Disk information object, or null.
Throws: IOException
If an I/O error occurs.
 o getFileInformation
 public abstract SMBFileInfo getFileInformation(String fname) throws IOException, FileNotFoundException
Get file information for the specified file.

Parameters:
fname - File name of the file to return information for.
Returns:
SMBFileInfo if the request was successful, else null.
Throws: IOException
If an I/O error occurs.
Throws: FileNotFoundException
If the remote file does not exist.
 o getWorkingDirectory
 public final String getWorkingDirectory()
Get the current working directory, relative to the share that is being accessed.

Returns:
Current working directory path string.
 o isClosed
 public final boolean isClosed()
Detemine if the disk session has been closed.

Returns:
true if the disk session has been closed, else false.
 o isDirectory
 public abstract boolean isDirectory(String dir) throws IOException
Check if the specified file name is a directory.

Parameters:
dir - Directory name string. If the directory name does not have a leading '\' the current working directory for this session will be preprended to the string.
Returns:
true if the specified file name is a directory, else false.
Throws: IOException
If an I/O error occurs.
 o OpenFile
 public abstract SMBFile OpenFile(String fname,
                                  int flags) throws IOException
Open a file on the remote file server.

Parameters:
fname - Remote file name string.
flags - File open option flags.
Returns:
SMBFile for the opened file, else null.
Throws: IOException
If an I/O error occurs
 o OpenInputStream
 public SMBInputStream OpenInputStream(String fname,
                                       int flags) throws IOException
Open a file as an input stream.

Parameters:
fname - Remote file name string.
flags - File open option flags.
Returns:
SMBInputStream for the opened file, else null.
Throws: IOException
If an I/O error occurs
 o OpenOutputStream
 public SMBOutputStream OpenOutputStream(String fname,
                                         int flags) throws IOException
Open a file as an output stream.

Parameters:
fname - Remote file name string.
flags - File open option flags.
Returns:
SMBOutputStream for the opened file, else null.
Throws: IOException
If an I/O error occurs
 o RenameFile
 public boolean RenameFile(String curnam,
                           String newnam) throws IOException
Rename a file, or set of files, on the remote file server.

Parameters:
curnam - Current file name string, may contain wildcards.
newnam - New file name.
attr - Search attributes, to determine which file(s) to rename.
Returns:
true if the file(s) were renamed, else false
Throws: IOException
If an I/O error occurs.
 o RenameFile
 public abstract boolean RenameFile(String curnam,
                                    String newnam,
                                    int attr) throws IOException
Rename a file, or set of files, on the remote file server.

Parameters:
curnam - Current file name string, may contain wildcards.
newnam - New file name.
attr - Search attributes, to determine which file(s) to rename.
Returns:
true if the file(s) were renamed, else false
Throws: IOException
If an I/O error occurs.
 o setFileInformation
 public abstract void setFileInformation(String fname,
                                         SMBFileInfo finfo,
                                         int flags) throws IOException
Set file information for the specified file.

Parameters:
fname - File name of the file to set information for.
finfo - File information containing the new values.
flags - Bit mask of the information to set.
Throws: IOException
If an I/O error occurs.
 o setWorkingDirectory
 public final void setWorkingDirectory(String wd)
Set the current working directory, relative to the share that is being accessed.

Parameters:
wd - Working directory path string.
 o StartSearch
 public abstract SMBSearchContext StartSearch(String dir,
                                              int attr) throws IOException
Start a search of the specified directory returning information for each file/directory found.

Parameters:
dir - Directory/file name string, which may contain wildcards. If the directory string does not start with a '\' then the directory name is prepended with the current working directory.
attr - Search attributes, to determine the types of files/directories returned.
Returns:
SMBSearchContext for this search, else null
Throws: IOException
If an I/O error occurs

All Packages  Class Hierarchy  This Package  Previous  Next  Index