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.
-
Attributes
- Set the file attributes, via the setFileInformation () method
-
WriteDate
- Set the file write date, via the setFileInformation () method
-
WriteTime
- Set the file write time, via the setFileInformation () method
-
CloseSession()
- Close this connection with the remote server share.
-
CreateDirectory(String)
- Createa new directory on the remote file server.
-
DeleteDirectory(String)
- Delete the specified directory on the remote file server.
-
DeleteFile(String)
- Delete the specified file on the remote file server.
-
DeleteFile(String, int)
- Delete the specified file on the remote file server.
-
FileExists(String)
- Check if a file exists on the remote file server.
-
getDiskInformation()
- Get disk information for this remote disk.
-
getFileInformation(String)
- Get file information for the specified file.
-
getWorkingDirectory()
- Get the current working directory, relative to the share that is being
accessed.
-
isClosed()
- Detemine if the disk session has been closed.
-
isDirectory(String)
- Check if the specified file name is a directory.
-
OpenFile(String, int)
- Open a file on the remote file server.
-
OpenInputStream(String, int)
- Open a file as an input stream.
-
OpenOutputStream(String, int)
- Open a file as an output stream.
-
RenameFile(String, String)
- Rename a file, or set of files, on the remote file server.
-
RenameFile(String, String, int)
- Rename a file, or set of files, on the remote file server.
-
setFileInformation(String, SMBFileInfo, int)
- Set file information for the specified file.
-
setWorkingDirectory(String)
- Set the current working directory, relative to the share that is being
accessed.
-
StartSearch(String, int)
- Start a search of the specified directory returning information for each
file/directory found.
Attributes
public static final int Attributes
- Set the file attributes, via the setFileInformation () method
WriteTime
public static final int WriteTime
- Set the file write time, via the setFileInformation () method
WriteDate
public static final int WriteDate
- Set the file write date, via the setFileInformation () method
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
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.
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.
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.
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.
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.
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.
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.
getWorkingDirectory
public final String getWorkingDirectory()
- Get the current working directory, relative to the share that is being
accessed.
- Returns:
- Current working directory path string.
isClosed
public final boolean isClosed()
- Detemine if the disk session has been closed.
- Returns:
- true if the disk session has been closed, else false.
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.
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
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
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
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.
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.
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.
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.
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