org.gnu.jcifs
Class CifsDiskContext

java.lang.Object
  |
  +--org.gnu.jcifs.CifsDiskContext

public class CifsDiskContext
extends java.lang.Object

CifsDiskContext is a helper class. The JCIFS runtime does not use it. You can use the class to save user specific data and to implement the current directory concept.

After connecting to disk, you can create a CifsDiskContext object and save it as a property:

      CifsDisk disk;
      ....
      CifsDiskContext ctxt = new CifsDiskContext(disk);
      disk.setProperty("mycontext",ctxt);
 
Whenever you need the context object:

    CifsDiskContext ctxt = (CifsDiskContext)disk.getProperty("mycontext");
 

Since:
1.0
Version:
1.0, 20 Nov 1998
See Also:
CifsSession.setProperty(java.lang.String, java.lang.Object), CifsSession.getProperty(java.lang.String)

Constructor Summary
CifsDiskContext(CifsDisk disk)
          Creates a new context object
 
Method Summary
 void changeCurrentDir(java.lang.String newdir)
          Changes current directory.
 java.lang.String getCurrentDir()
          Returns the current directory (relative to share)
 CifsDisk getDisk()
          Returns the corresponding disk object
 java.lang.String getPathName(java.lang.String file)
          Returns the path name: If the file starts with \ (or) /, the pathname=filename, otherwise pathname = current-dir/filename
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CifsDiskContext

public CifsDiskContext(CifsDisk disk)
Creates a new context object
Parameters:
disk - disk object
Method Detail

getCurrentDir

public final java.lang.String getCurrentDir()
Returns the current directory (relative to share)
Returns:
directory

changeCurrentDir

public final void changeCurrentDir(java.lang.String newdir)
                            throws java.io.IOException
Changes current directory. If the name begins with \, the new directory is relative to the share, otherwise relative the current directory
Parameters:
newdir - new directory name
Throws:
java.io.IOException - if directory does not exists

getPathName

public final java.lang.String getPathName(java.lang.String file)
Returns the path name: If the file starts with \ (or) /, the pathname=filename, otherwise pathname = current-dir/filename
Parameters:
file - file name
Returns:
path name

getDisk

public CifsDisk getDisk()
Returns the corresponding disk object
Returns:
disk object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Norbert Hranitzky