org.gnu.jcifs
Interface CifsDisk


public interface CifsDisk
extends CifsSession

CifsDisk declares the disk operations.

How to access the disk service?

   CifsDisk disk = CifsSessionManager.connectDisk("sessionname","\\server\share");
 

Since:
1.0
Version:
1.0, 21 Nov 1998
See Also:
CifsSessionManager.connectDisk(java.lang.String, java.lang.String)

Field Summary
static int SM_DENY_NONE
          Allow all actions
static int SM_DENY_READ_EXEC
          Deny read/execute
static int SM_DENY_WRITE
          Deny write
static int SM_EXCLUSIVE
          Deny read/write/execute (exclusive)
 
Method Summary
 void deleteFile(java.lang.String file)
          Deletes the given file
 boolean directoryExists(java.lang.String dirname)
          Checks if directory exists
 long getFile(java.lang.String file, java.io.OutputStream out)
          Gets the file from the server and writes the content to the given output stream.
 long getFile(java.lang.String file, java.io.Writer out)
          Gets the file from the server and writes the content to the given output stream.
 CifsFileInfo getFileInfo(java.lang.String file)
          Returns information about the given file
 CifsFileSystemInfo getFileSystemInfo()
          Returns informations about the filesystem
 CifsFileInfo[] listFilesInfo(java.lang.String file, int searchattr, boolean sort)
          Enumerates informations about the files
 java.lang.String[] listFilesName(java.lang.String file, int searchattr, boolean sort)
          Enumerates file names
 void mkdir(java.lang.String dirname)
          Creates the given directory on the server
 long putFile(java.lang.String file, java.io.InputStream in)
          Puts the data from the input stream to the given remote file.
 long putFile(java.lang.String file, java.io.Reader in)
          Puts the data from the input stream to the given remote file.
 void renameFile(java.lang.String oldfile, java.lang.String newfile)
          Renames the old file to the new file (also hidden and system files)
 void renameFile(java.lang.String oldfile, java.lang.String newfile, int searchattr)
          Renames file corresponding to the search attributes
 void rmdir(java.lang.String dirname)
          Removes directory
 void setFileAttribute(java.lang.String file, int attr, boolean set)
          Sets or resets file attributes (CifsFileInfo.FILE_ATTR_*)
 
Methods inherited from interface org.gnu.jcifs.CifsSession
disconnect, echo, getConnectTime, getNetBIOSName, getProperty, getServerAddress, getServerLanMan, getServerOS, getServerPrimaryDomain, getServerTime, getServerTimeZone, getSessionName, getShareName, isConnected, isUserLevelSecurity, reconnect, setAllowAutoReconnection, setProperty
 

Field Detail

SM_EXCLUSIVE

public static final int SM_EXCLUSIVE
Deny read/write/execute (exclusive)

SM_DENY_WRITE

public static final int SM_DENY_WRITE
Deny write

SM_DENY_READ_EXEC

public static final int SM_DENY_READ_EXEC
Deny read/execute

SM_DENY_NONE

public static final int SM_DENY_NONE
Allow all actions
Method Detail

getFile

public long getFile(java.lang.String file,
                    java.io.OutputStream out)
             throws java.io.IOException
Gets the file from the server and writes the content to the given output stream. The file will not be locked
Parameters:
file - remote file name (relativ to share)
out - output stream
Returns:
number of bytes
Throws:
java.io.IOException - if an I/O error occurs.

getFile

public long getFile(java.lang.String file,
                    java.io.Writer out)
             throws java.io.IOException
Gets the file from the server and writes the content to the given output stream. The file will not be locked
Parameters:
file - remote file name (relativ to share)
out - writer
Returns:
number of bytes
Throws:
java.io.IOException - if an I/O error occurs.

putFile

public long putFile(java.lang.String file,
                    java.io.Reader in)
             throws java.io.IOException
Puts the data from the input stream to the given remote file. The file will not be locked
Parameters:
file - remote file name (relativ to share)
in - input reader
Returns:
number of bytes
Throws:
java.io.IOException - if an I/O error occurs.

putFile

public long putFile(java.lang.String file,
                    java.io.InputStream in)
             throws java.io.IOException
Puts the data from the input stream to the given remote file. The file will not not locked
Parameters:
file - remote file name (relativ to share)
in - input stream
Returns:
number of bytes
Throws:
java.io.IOException - if an I/O error occurs.

deleteFile

public void deleteFile(java.lang.String file)
                throws java.io.IOException
Deletes the given file
Parameters:
file - remote file name
Throws:
java.io.IOException - if an I/O error occurs.

renameFile

public void renameFile(java.lang.String oldfile,
                       java.lang.String newfile)
                throws java.io.IOException
Renames the old file to the new file (also hidden and system files)
Parameters:
oldfile - old file
newfile - new file
Throws:
java.io.IOException - if an I/O error occurs.

renameFile

public void renameFile(java.lang.String oldfile,
                       java.lang.String newfile,
                       int searchattr)
                throws java.io.IOException
Renames file corresponding to the search attributes
Parameters:
oldfile - old file
newfile - new file
searchattr - search attributes (see CifsFileInfo.FILE_ATTR_*)
Throws:
java.io.IOException - if an I/O error occurs.
See Also:
CifsFile, CifsFileInfo

setFileAttribute

public void setFileAttribute(java.lang.String file,
                             int attr,
                             boolean set)
                      throws java.io.IOException
Sets or resets file attributes (CifsFileInfo.FILE_ATTR_*)
Parameters:
file - file name
attr - new file attributes
set - if true sets the given attributes otherwise resets it
Throws:
java.io.IOException - if an I/O error occurs.
See Also:
CifsFile, CifsFileInfo

mkdir

public void mkdir(java.lang.String dirname)
           throws java.io.IOException
Creates the given directory on the server
Parameters:
dirname - directory name
Throws:
java.io.IOException - if an I/O error occurs.

rmdir

public void rmdir(java.lang.String dirname)
           throws java.io.IOException
Removes directory
Parameters:
dirname - directory name
Throws:
java.io.IOException - if an I/O error occurs.

directoryExists

public boolean directoryExists(java.lang.String dirname)
                        throws java.io.IOException
Checks if directory exists
Parameters:
dirname - directory name
Returns:
true if directory exits
Throws:
java.io.IOException - if an I/O error occurs.

getFileSystemInfo

public CifsFileSystemInfo getFileSystemInfo()
                                     throws java.io.IOException
Returns informations about the filesystem
Returns:
CifsFileSystemInfo filesystem informations
Throws:
java.io.IOException - if an I/O error occurs.

getFileInfo

public CifsFileInfo getFileInfo(java.lang.String file)
                         throws java.io.IOException
Returns information about the given file
Parameters:
file - file name
Returns:
CifsFileInfo
Throws:
java.io.IOException - if an I/O error occurs.

listFilesInfo

public CifsFileInfo[] listFilesInfo(java.lang.String file,
                                    int searchattr,
                                    boolean sort)
                             throws java.io.IOException
Enumerates informations about the files
Parameters:
file - file name (with wildcards)
searchattr - file attributes (see CifsFileInfo.FILE_ATTR_*)
sort - if true names will be sorted
Returns:
array of CifsFileInfo elements
Throws:
java.io.IOException - if an I/O error occurs.

listFilesName

public java.lang.String[] listFilesName(java.lang.String file,
                                        int searchattr,
                                        boolean sort)
                                 throws java.io.IOException
Enumerates file names
Parameters:
file - file name (with wildcards)
searchattr - file attributes
sort - if true names will be sorted
Returns:
array of java.lang.String elements
Throws:
java.io.IOException - if an I/O error occurs.

Norbert Hranitzky