crystalspace.jbind.interfaces.iutil.vfs
Interface iVFS

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csVFS

public interface iVFS
extends iBase

The Virtual Filesystem Class is intended to be the only way for Crystal Space engine to access the files. This gives unified control over the way how files are found, read and written. VFS gives the following goodies over the standard file i/o functions: * Multiple search directories. Several "real" directories can be collected together into one "virtual" directory. * Directories can be mapped to "real" directories as well as to archives (.zip files). Files are compressed/decompressed transparently for clients. * The Virtual File System is unique across all operating systems Crystal Space supports, no matter of features of the underlying OS. This class has only most basic features of a real filesystem: file reading and writing (no simultaneous read and write mode are allowed because it would be rather complex to implement it for archives). However, most programs don't even need such functionality, and for sure Crystal Space itself doesn't need it. Files open for writing are always truncated. A simple meaning for getting a list of files in a virtual directory is implemented; however the user is presented with only a list of file names; no fancy things like file size, time etc (file size can be determined after opening it for reading).

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/devapi/structiVFS.php

Method Summary
 boolean chDir(java.lang.String Path)
          Set current working directory.
 boolean deleteFile(java.lang.String FileName)
          Delete a file on VFS.
 boolean exists(java.lang.String Path)
          Check whenever a file exists.
 iDataBuffer expandPath(java.lang.String Path, boolean IsDir)
          Expand given virtual path, interpret all "." and ".."'
 iStringArray findFiles(java.lang.String Path)
          Find all files in a virtual directory and return an array with their names.
 java.lang.String getCwd()
          Get current working directory.
 java.lang.Long getFileSize(java.lang.String FileName)
          Query file size (without opening it).
 java.util.Date getFileTime(java.lang.String FileName)
          Query file date/time.
 iDataBuffer getRealPath(java.lang.String FileName)
          Query real-world path from given VFS path.
 boolean mount(java.lang.String VirtualPath, java.lang.String RealPath)
          Mount an VFS path on a "real-world-filesystem" path.
 iStringArray mountRoot(java.lang.String VirtualPath)
          Mount the root directory or directories beneath the given virtual path.
 iFile open(java.lang.String FileName, int Mode)
          Replacement for standard fopen().
 boolean popDir()
          Pop current directory.
 void pushDir()
          Push current directory.
 iDataBuffer readFile(java.lang.String FileName, boolean nullterm)
          Get an entire file at once.
 boolean saveMounts(java.lang.String FileName)
          Save current configuration back into configuration file.
 boolean setFileTime(java.lang.String FileName, java.util.Date dDate)
          Set file date/time.
 boolean sync()
          Close all opened archives, free temporary storage etc.
 boolean unmount(java.lang.String VirtualPath, java.lang.String RealPath)
          Unmount an VFS path; if RealPath is 0, entire VirtualPath is unmounted.
 boolean writeFile(java.lang.String Name, byte[] Data)
          Write an entire file in one pass.
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getName, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

chDir

public boolean chDir(java.lang.String Path)
Set current working directory.

Parameters:
Path -
Returns:

getCwd

public java.lang.String getCwd()
Get current working directory.

Returns:

pushDir

public void pushDir()
Push current directory.


popDir

public boolean popDir()
Pop current directory.

Returns:

expandPath

public iDataBuffer expandPath(java.lang.String Path,
                              boolean IsDir)
Expand given virtual path, interpret all "." and ".."'s relative to 'currend virtual directory'. Return a new iString object. If IsDir is true, expanded path ends in an '/', otherwise no. Implemented in csVFS

Parameters:
Path -
IsDir -
Returns:

exists

public boolean exists(java.lang.String Path)
Check whenever a file exists.

Parameters:
Path -
Returns:

findFiles

public iStringArray findFiles(java.lang.String Path)
Find all files in a virtual directory and return an array with their names. Implemented in csVFS

Parameters:
Path -
Returns:

open

public iFile open(java.lang.String FileName,
                  int Mode)
Replacement for standard fopen(). Mode: combination of VFS_FILE_XXX. See also: VFS_FILE_MODE Implemented in csVFS.

Parameters:
FileName -
Mode -
Returns:

readFile

public iDataBuffer readFile(java.lang.String FileName,
                            boolean nullterm)
Get an entire file at once. This is more effective than opening files and reading the file in blocks. Note that the returned buffer can be null-terminated (so that it can be conveniently used with string functions) but the extra null-terminator is not counted as part of the returned size. Parameters: FileName VFS path of the file to be read.ยต nullterm Null-terminate the returned buffer. Returns: Interface to the contained data. Remarks: Null-termination might have a performance penalty (dependent on where the file is stored.) Use only when needed. Implemented in csVFS

Parameters:
FileName -
nullterm -
Returns:

writeFile

public boolean writeFile(java.lang.String Name,
                         byte[] Data)
Write an entire file in one pass. Implemented in csVFS.

Parameters:
Name -
Data -
Returns:

deleteFile

public boolean deleteFile(java.lang.String FileName)
Delete a file on VFS. Implemented in csVFS.

Parameters:
FileName -
Returns:

sync

public boolean sync()
Close all opened archives, free temporary storage etc. Implemented in csVFS.

Returns:

mount

public boolean mount(java.lang.String VirtualPath,
                     java.lang.String RealPath)
Mount an VFS path on a "real-world-filesystem" path. Implemented in csVFS.

Parameters:
VirtualPath -
RealPath -
Returns:

unmount

public boolean unmount(java.lang.String VirtualPath,
                       java.lang.String RealPath)
Unmount an VFS path; if RealPath is 0, entire VirtualPath is unmounted. Implemented in csVFS.

Parameters:
VirtualPath -
RealPath -
Returns:

mountRoot

public iStringArray mountRoot(java.lang.String VirtualPath)
Mount the root directory or directories beneath the given virtual path. Returns a list of absolute virtual pathnames mounted by this operation. Implemented in csVFS.

Parameters:
VirtualPath -
Returns:

saveMounts

public boolean saveMounts(java.lang.String FileName)
Save current configuration back into configuration file. Implemented in csVFS.

Parameters:
FileName -
Returns:

getFileTime

public java.util.Date getFileTime(java.lang.String FileName)
Query file date/time. Implemented in csVFS

Parameters:
FileName -
Returns:

setFileTime

public boolean setFileTime(java.lang.String FileName,
                           java.util.Date dDate)
Set file date/time. Implemented in csVFS

Parameters:
FileName -
dDate -
Returns:

getFileSize

public java.lang.Long getFileSize(java.lang.String FileName)
Query file size (without opening it). Implemented in csVFS

Parameters:
FileName -
Returns:

getRealPath

public iDataBuffer getRealPath(java.lang.String FileName)
Query real-world path from given VFS path. This will work only for files that are stored on real filesystem, not in archive files. You should expect this function to return 0 in this case. Implemented in csVFS.

Parameters:
FileName -
Returns: