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.io
Class IO

    java.lang.Object
      org.basex.io.IO

Direct Known Subclasses:
  IOContent, IOFile, IOUrl

    public abstract class IO

extends java.lang.Object

BaseX file representation, pointing to a local or remote file or byte array contents.

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

Field Summary
`static java.lang.String` | `BASEXSUFFIX` BaseX Suffix.
`static double` | `BLOCKFILL` Fill Factor (greater than 0.0, maximum 1.0).
`static int` | `BLOCKSIZE` Block size.
`static IO` | `DUMMY` Return IO dummy instance.
`static java.lang.String` | `GZSUFFIX` GZIP Suffix.
`static int` | `MAXHEIGHT` Maximum Tree depth.
`static int` | `NODEPOWER` Table NodeSize Power.
`static java.lang.String` | `TXTSUFFIX` Text Suffix.
`static java.lang.String` | `XMLSUFFIX` XML Suffix.
`static java.lang.String` | `XQSUFFIX` XQuery Suffix.
`static java.lang.String` | `ZIPSUFFIX` ZIP Suffix.

Method Summary
`abstract BufferInput` | `buffer()` Returns a buffered reader for the file.
`abstract void` | `cache()` Caches the contents.
`IO[]` | `children()` Returns the children of a document.
`byte[]` | `content()` Returns the contents.
`long` | `date()` Returns the modification date of this file.
`static boolean` | `dbdelete(java.lang.String db, java.lang.String pat)` Recursively deletes a directory.
`static java.io.File` | `dbfile(java.lang.String db, java.lang.String file)` Adds the database suffix to the specified filename and creates a file instance.
`java.lang.String` | `dbname()` Chops the path and the XML suffix of the specified filename.
`static java.io.File` | `dbpath(java.lang.String db)` Returns a file instance for the current database path.
`boolean` | `delete()` Chops the path and the XML suffix of the specified filename.
`boolean` | `eq(IO io)` Compares the filename of the specified IO reference.
`boolean` | `exists()` Verifies if the file exists.
`static IO` | `get(java.lang.String s)` Constructor.
`java.lang.String` | `getDir()` Returns the directory of this path.
`abstract org.xml.sax.InputSource` | `inputSource()` Returns the next input source.
`boolean` | `isDir()` Returns if this is a directory instance.
`boolean` | `isSymLink()` Returns if this is a directory instance.
`static boolean` | `isSymlink(java.io.File f)` Determines if the specified file is a symbolic link.
`long` | `length()` Returns the file length.
`IO` | `merge(IO f)` Merges two filenames.
`boolean` | `more()` Checks if more input streams are found.
`java.lang.String` | `name()` Chops the path and the XML suffix of the specified filename.
`java.lang.String` | `path()` Chops the path and the XML suffix of the specified filename.
`void` | `suffix(java.lang.String suf)` Sets the specified suffix if none exists.
`java.lang.String` | `toString()`
`static java.lang.String` | `url(java.lang.String path)` Creates a URL from the specified path.
`static boolean` | `valid(java.lang.String fn)` Checks if the specified filename is valid; allows only letters, digits and some special characters.
`void` | `write(byte[] c)` Writes the specified file contents.

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

Field Detail

### DUMMY

    public static final IO DUMMY

  Return IO dummy instance.

### BASEXSUFFIX

    public static final java.lang.String BASEXSUFFIX

  BaseX Suffix.

  See Also:
    Constant Field Values

### XQSUFFIX

    public static final java.lang.String XQSUFFIX

  XQuery Suffix.

  See Also:
    Constant Field Values

### TXTSUFFIX

    public static final java.lang.String TXTSUFFIX

  Text Suffix.

  See Also:
    Constant Field Values

### XMLSUFFIX

    public static final java.lang.String XMLSUFFIX

  XML Suffix.

  See Also:
    Constant Field Values

### ZIPSUFFIX

    public static final java.lang.String ZIPSUFFIX

  ZIP Suffix.

  See Also:
    Constant Field Values

### GZSUFFIX

    public static final java.lang.String GZSUFFIX

  GZIP Suffix.

  See Also:
    Constant Field Values

### BLOCKSIZE

    public static final int BLOCKSIZE

  Block size.

  See Also:
    Constant Field Values

### NODEPOWER

    public static final int NODEPOWER

  Table NodeSize Power.

  See Also:
    Constant Field Values

### BLOCKFILL

    public static final double BLOCKFILL

  Fill Factor (greater than 0.0, maximum 1.0).

  See Also:
    Constant Field Values

### MAXHEIGHT

    public static final int MAXHEIGHT

  Maximum Tree depth.

  See Also:
    Constant Field Values

Method Detail

### get

    public static IO get(java.lang.String s)

  Constructor.

  Parameters:
    `s` - source
  Returns:
    IO reference

### content

    public final byte[] content()
                         throws java.io.IOException

  Returns the contents.

  Returns:
    contents
  Throws:
    `java.io.IOException` - I/O exception

### cache

    public abstract void cache()
                        throws java.io.IOException

  Caches the contents.

  Throws:
    `java.io.IOException` - I/O exception

### exists

    public boolean exists()

  Verifies if the file exists.

  Returns:
    result of check

### isDir

    public boolean isDir()

  Returns if this is a directory instance.

  Returns:
    result of check

### isSymLink

    public boolean isSymLink()
                      throws java.io.IOException

  Returns if this is a directory instance.

  Returns:
    result of check
  Throws:
    `java.io.IOException` - I/O exception

### getDir

    public final java.lang.String getDir()

  Returns the directory of this path.

  Returns:
    result of check

### date

    public long date()

  Returns the modification date of this file.

  Returns:
    modification date

### length

    public long length()

  Returns the file length.

  Returns:
    file length

### more

    public boolean more()
                 throws java.io.IOException

  Checks if more input streams are found.

  Returns:
    result of check
  Throws:
    `java.io.IOException` - I/O exception

### inputSource

    public abstract org.xml.sax.InputSource inputSource()

  Returns the next input source.

  Returns:
    input source

### buffer

    public abstract BufferInput buffer()
                                throws java.io.IOException

  Returns a buffered reader for the file.

  Returns:
    buffered reader
  Throws:
    `java.io.IOException` - I/O exception

### merge

    public IO merge(IO f)

  Merges two filenames.

  Parameters:
    `f` - filename of the file
  Returns:
    contents

### suffix

    public final void suffix(java.lang.String suf)

  Sets the specified suffix if none exists.

  Parameters:
    `suf` - suffix

### dbname

    public final java.lang.String dbname()

  Chops the path and the XML suffix of the specified filename. Returns "tmp" if name is empty.

  Returns:
    chopped filename

### name

    public final java.lang.String name()

  Chops the path and the XML suffix of the specified filename.

  Returns:
    chopped filename

### path

    public final java.lang.String path()

  Chops the path and the XML suffix of the specified filename.

  Returns:
    chopped filename

### children

    public IO[] children()

  Returns the children of a document.

  Returns:
    chopped filename

### write

    public void write(byte[] c)
               throws java.io.IOException

  Writes the specified file contents.

  Parameters:
    `c` - contents
  Throws:
    `java.io.IOException` - I/O exception

### delete

    public boolean delete()

  Chops the path and the XML suffix of the specified filename.

  Returns:
    chopped filename

### eq

    public final boolean eq(IO io)

  Compares the filename of the specified IO reference.

  Parameters:
    `io` - io reference
  Returns:
    result of check

### toString

    public final java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### dbfile

    public static java.io.File dbfile(java.lang.String db,
                                      java.lang.String file)

  Adds the database suffix to the specified filename and creates a file instance.

  Parameters:
    `db` - name of the database
    `file` - filename
  Returns:
    database filename

### dbpath

    public static java.io.File dbpath(java.lang.String db)

  Returns a file instance for the current database path.

  Parameters:
    `db` - name of the database
  Returns:
    database filename

### dbdelete

    public static boolean dbdelete(java.lang.String db,
                                   java.lang.String pat)

  Recursively deletes a directory.

  Parameters:
    `db` - database to delete
    `pat` - file pattern
  Returns:
    success of operation

### valid

    public static boolean valid(java.lang.String fn)

  Checks if the specified filename is valid; allows only letters, digits and some special characters.

  Parameters:
    `fn` - filename
  Returns:
    result of check

### url

    public static final java.lang.String url(java.lang.String path)

  Creates a URL from the specified path.

  Parameters:
    `path` - path to be converted
  Returns:
    URL

### isSymlink

    public static boolean isSymlink(java.io.File f)
                             throws java.io.IOException

  Determines if the specified file is a symbolic link.

  Parameters:
    `f` - file to be tested.
  Returns:
    true for a symbolic link
  Throws:
    `java.io.IOException` - I/O exception

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