Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.fs
Class DataFS

    java.lang.Object
      org.basex.fs.DataFS

    public final class DataFS

extends java.lang.Object

Preliminary collection of file system methods.

Author:
  Workgroup DBIS, University of Konstanz 2005-08, ISC License, Christian Gruen & Hannes Schwarz

Field Summary
`int` | `dirID` Index References.
`int` | `fileID` Index References.
`static boolean` | `FLUSH` Force flush after each update.
`static int` | `ROOTDIR` Root dir.
`int` | `suffID` Index References.
`int` | `timeID` Index References.

Constructor Summary
`DataFS(Data d)` Constructor.

Method Summary
`int[]` | `children(int pre)` Returns all directories and files of a directory.
`int[]` | `children(int pre, java.lang.String path)` Returns the pre values of files or dir.
`byte[]` | `currTime()` Returns the current time in the FS format.
`int` | `dir(int pre, java.lang.String path)` Returns the pre value of a dir.
`void` | `flush()` Flushes the data.
`int` | `goTo(int pre, java.lang.String path)` Returns the pre value of the resulting directory.
`void` | `insert(boolean isDir, byte[] name, byte[] suffix, byte[] size, byte[] mtime, int parent, int pre)` Inserts a new entry into the table.
`boolean` | `isDir(int pre)` Checks if the specified node is a directory.
`boolean` | `isFile(int pre)` Checks if the specified node is a file.
`void` | `launch(int pre)` Opens the file which is defined by the specified pre value.
`byte[]` | `name(int pre)` Returns the name of a file.
`byte[]` | `path(int pre)` Returns the path of a file.
`byte[]` | `path(int pre, int par, boolean abs)` Returns the relative path of a file.
`java.lang.String` | `regex(java.lang.String expr)` Tests if wildcards are used.
`byte[]` | `size(int pre)` Returns the size of a file.
`void` | `size(int pre, byte[] size)` Sets the size of a file.
`byte[]` | `suffix(int pre)` Returns the suffix of a file.
`byte[]` | `time(int pre)` Returns the Mtime of a file.
`void` | `time(int pre, byte[] mtime)` Sets the Mtime of a file.
`boolean` | `valid(java.lang.String file)` Returns if the file/dir expression is valid.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FLUSH

    public static final boolean FLUSH

  Force flush after each update.

  See Also:
    Constant Field Values

### ROOTDIR

    public static final int ROOTDIR

  Root dir.

  See Also:
    Constant Field Values

### fileID

    public int fileID

  Index References.

### dirID

    public int dirID

  Index References.

### suffID

    public int suffID

  Index References.

### timeID

    public int timeID

  Index References.

Constructor Detail

### DataFS

    public DataFS(Data d)

  Constructor.

  Parameters:
    `d` - data reference

Method Detail

### isFile

    public boolean isFile(int pre)

  Checks if the specified node is a file.

  Parameters:
    `pre` - pre value
  Returns:
    result of comparison

### isDir

    public boolean isDir(int pre)

  Checks if the specified node is a directory.

  Parameters:
    `pre` - pre value
  Returns:
    result of comparison

### path

    public byte[] path(int pre)

  Returns the path of a file.

  Parameters:
    `pre` - pre value
  Returns:
    file path.

### path

    public byte[] path(int pre,
                       int par,
                       boolean abs)

  Returns the relative path of a file.

  Parameters:
    `pre` - pre value of current node
    `par` - pre value of last dir to print
    `abs` - absolute flag
  Returns:
    file path.

### name

    public byte[] name(int pre)

  Returns the name of a file.

  Parameters:
    `pre` - pre value
  Returns:
    file name.

### size

    public byte[] size(int pre)

  Returns the size of a file.

  Parameters:
    `pre` - pre value
  Returns:
    file size

### size

    public void size(int pre,
                     byte[] size)

  Sets the size of a file.

  Parameters:
    `pre` - pre value
    `size` - to set

### time

    public byte[] time(int pre)

  Returns the Mtime of a file.

  Parameters:
    `pre` - pre value
  Returns:
    file name.

### time

    public void time(int pre,
                     byte[] mtime)

  Sets the Mtime of a file.

  Parameters:
    `pre` - pre value
    `mtime` - to set

### suffix

    public byte[] suffix(int pre)

  Returns the suffix of a file.

  Parameters:
    `pre` - pre value
  Returns:
    file name.

### currTime

    public byte[] currTime()

  Returns the current time in the FS format.

  Returns:
    current time

### children

    public int[] children(int pre)

  Returns all directories and files of a directory.

  Parameters:
    `pre` - pre value of the "parent" directory
  Returns:
    all pre values of the dirs and files

### children

    public int[] children(int pre,
                          java.lang.String path)

  Returns the pre values of files or dir. The names are described by a pattern.

  Parameters:
    `pre` - pre value of the "parent" directory
    `path` - directory name
  Returns:
    all pre values of all files

### dir

    public int dir(int pre,
                   java.lang.String path)

  Returns the pre value of a dir.

  Parameters:
    `pre` - pre value of the "parent" directory
    `path` - path name
  Returns:
    all pre values of all files

### goTo

    public int goTo(int pre,
                    java.lang.String path)

  Returns the pre value of the resulting directory.

  Parameters:
    `pre` - pre value
    `path` - path expression
  Returns:
    pre value of the result dir

### regex

    public java.lang.String regex(java.lang.String expr)

  Tests if wildcards are used. If true it returns the regular expression. If not null will be returned.

  Parameters:
    `expr` - the expression of the user
  Returns:
    If a wildcard is used a regular expression is returned otherwise null

### valid

    public boolean valid(java.lang.String file)

  Returns if the file/dir expression is valid.

  Parameters:
    `file` - file/directory
  Returns:
    result of check

### insert

    public void insert(boolean isDir,
                       byte[] name,
                       byte[] suffix,
                       byte[] size,
                       byte[] mtime,
                       int parent,
                       int pre)

  Inserts a new entry into the table.

  Parameters:
    `isDir` - insert dir or file
    `name` - filename
    `suffix` - suffix of the file
    `size` - size of the file
    `mtime` - make time
    `parent` - pre value of the parent
    `pre` - position to insert

### launch

    public void launch(int pre)

  Opens the file which is defined by the specified pre value.

  Parameters:
    `pre` - pre value

### flush

    public void flush()

  Flushes the data. If the `FLUSH` flag is set to false, flushing will be skipped at this stage.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD