org.gnu.jcifs
Class CifsFile

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

public final class CifsFile
extends java.lang.Object
implements CifsFileInfo

CifsFile represents a CIFS file

Since:
1.0
Version:
1.0, 20 Nov 1998

Fields inherited from interface org.gnu.jcifs.CifsFileInfo
FILE_ATTR_ALL, FILE_ATTR_ANY, FILE_ATTR_ARCHIVE, FILE_ATTR_DIRECTORY, FILE_ATTR_HIDDEN_FILE, FILE_ATTR_READ_ONLY, FILE_ATTR_SYSTEM_FILE, FILE_ATTR_VOLUME
 
Constructor Summary
CifsFile(CifsDisk disk, java.lang.String file)
          Creates a new CifsFile object.
CifsFile(java.lang.String sessionname, java.lang.String file)
          Creates a new CifsFile object.
 
Method Summary
 void delete()
          Deletes the current file or directory
 boolean exists()
          Checks if the file exists
 int getAttributes()
          Returns file attribute flag
 java.util.Date getCreationTime()
          Returns creation time of the file/directory
 CifsDisk getDisk()
          Returns the disk object
 java.lang.String getFileName()
          Returns file name
 java.util.Date getLastAccessTime()
          Returns last access time of the file/directory
 java.util.Date getLastWriteTime()
          Returns last write time of the file/directory
 java.lang.String getPathName()
          Returns the path name
 boolean isArchive()
          Returns if file is a archive file
 boolean isDirectory()
          Checks if file is a directory
 boolean isFile()
          Checks if is a file
 boolean isHidden()
          Returns if file is a hidden file
 boolean isReadOnly()
          Returns true if file is read only
 boolean isSystem()
          Returns if file is a system file
 long length()
          Returns file size
 void mkdir()
          Create directory
 void refresh()
          Refresh file informations.
 void renameTo(java.lang.String file)
          Renames current file/directory to the given file
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CifsFile

public CifsFile(CifsDisk disk,
                java.lang.String file)
         throws java.io.IOException
Creates a new CifsFile object.
Parameters:
disk - disk object
file - file name
Throws:
java.io.IOException - if an I/O error occurs.

CifsFile

public CifsFile(java.lang.String sessionname,
                java.lang.String file)
         throws java.io.IOException
Creates a new CifsFile object.
Parameters:
sessionname - the name of the connected disk session
file - file name
Throws:
java.io.IOException - if an I/O error occurs.
Method Detail

getDisk

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

exists

public boolean exists()
Checks if the file exists
Returns:
true if file exists

refresh

public void refresh()
Refresh file informations. If the file was deleted, created or the attributes of the file was changed, you must call this method to update file information hold in this object

delete

public void delete()
            throws java.io.IOException
Deletes the current file or directory
Throws:
java.io.IOException - if an I/O error occurs.

mkdir

public void mkdir()
           throws java.io.IOException
Create directory
Throws:
java.io.IOException - if an I/O error occurs.

renameTo

public void renameTo(java.lang.String file)
              throws java.io.IOException
Renames current file/directory to the given file
Parameters:
file - new file name
Throws:
java.io.IOException - if an I/O error occurs.

getPathName

public java.lang.String getPathName()
Returns the path name
Specified by:
getPathName in interface CifsFileInfo
Returns:
path name

getFileName

public java.lang.String getFileName()
Returns file name
Specified by:
getFileName in interface CifsFileInfo
Returns:
file name

getCreationTime

public java.util.Date getCreationTime()
Returns creation time of the file/directory
Specified by:
getCreationTime in interface CifsFileInfo
Returns:
date

getLastAccessTime

public java.util.Date getLastAccessTime()
Returns last access time of the file/directory
Specified by:
getLastAccessTime in interface CifsFileInfo
Returns:
date

getLastWriteTime

public java.util.Date getLastWriteTime()
Returns last write time of the file/directory
Specified by:
getLastWriteTime in interface CifsFileInfo
Returns:
date

length

public long length()
Returns file size
Specified by:
length in interface CifsFileInfo
Returns:
size

isDirectory

public boolean isDirectory()
Checks if file is a directory
Specified by:
isDirectory in interface CifsFileInfo
Returns:
true if directory

isFile

public boolean isFile()
Checks if is a file
Specified by:
isFile in interface CifsFileInfo
Returns:
true if file

isReadOnly

public boolean isReadOnly()
Returns true if file is read only
Specified by:
isReadOnly in interface CifsFileInfo
Returns:
true if read only

isHidden

public boolean isHidden()
Returns if file is a hidden file
Specified by:
isHidden in interface CifsFileInfo
Returns:
true if hidden file

isSystem

public boolean isSystem()
Returns if file is a system file
Specified by:
isSystem in interface CifsFileInfo
Returns:
true if system file

isArchive

public boolean isArchive()
Returns if file is a archive file
Specified by:
isArchive in interface CifsFileInfo
Returns:
true if archive file

getAttributes

public int getAttributes()
Returns file attribute flag
Specified by:
getAttributes in interface CifsFileInfo
Returns:
flag

toString

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

Norbert Hranitzky