org.basex.io
Class IO

java.lang.Object
  extended by org.basex.io.IO
Direct Known Subclasses:
IOContent, IOFile, IOUrl

public abstract class IO
extends Object

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

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

Field Summary
static String BASEXSUFFIX
          Database suffix.
static double BLOCKFILL
          Fill Factor (0.0 - 1.0).
static int BLOCKSIZE
          Disk block/page size.
static IO DUMMY
          Return IO dummy instance.
static String GZSUFFIX
          GZIP Suffix.
static int MAXHEIGHT
          Maximum Tree depth.
static int NODEPOWER
          Table NodeSize Power.
static long NUMOFF
          Offset for inlining numbers.
static String XMLSUFFIX
          XML Suffix.
static String XQSUFFIX
          XQuery Suffix.
static 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.
 String dbname()
          Chops the path and the XML suffix of the specified filename and returns the database name.
 boolean delete()
          Chops the path and the XML suffix of the specified filename.
 String dir()
          Returns the directory.
 boolean eq(IO io)
          Compares the filename of the specified IO reference.
 boolean exists()
          Verifies if the file exists.
static IO get(String s)
          Constructor.
 String getDir()
          Returns the directory of this path.
abstract  InputSource inputSource()
          Returns the next input source.
 boolean isDir()
          Returns if this is a directory instance.
 long length()
          Returns the file length.
 boolean md()
          Creates the directory.
abstract  IO merge(String f)
          Merges two filenames.
 boolean more()
          Checks if more input streams are found.
 String name()
          Chops the path of the specified filename.
 String path()
          Returns the path.
 String toString()
           
 String url()
          Creates a URL from the specified path.
 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 String BASEXSUFFIX
Database suffix.

See Also:
Constant Field Values

XQSUFFIX

public static final String XQSUFFIX
XQuery Suffix.

See Also:
Constant Field Values

XMLSUFFIX

public static final String XMLSUFFIX
XML Suffix.

See Also:
Constant Field Values

ZIPSUFFIX

public static final String ZIPSUFFIX
ZIP Suffix.

See Also:
Constant Field Values

GZSUFFIX

public static final String GZSUFFIX
GZIP Suffix.

See Also:
Constant Field Values

BLOCKSIZE

public static final int BLOCKSIZE
Disk block/page 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 (0.0 - 1.0).

See Also:
Constant Field Values

MAXHEIGHT

public static final int MAXHEIGHT
Maximum Tree depth.

See Also:
Constant Field Values

NUMOFF

public static final long NUMOFF
Offset for inlining numbers.

See Also:
Constant Field Values
Method Detail

get

public static IO get(String s)
Constructor.

Parameters:
s - source
Returns:
IO reference

content

public final byte[] content()
                     throws IOException
Returns the contents.

Returns:
contents
Throws:
IOException - I/O exception

cache

public abstract void cache()
                    throws IOException
Caches the contents.

Throws:
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

getDir

public final 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 IOException
Checks if more input streams are found.

Returns:
result of check
Throws:
IOException - I/O exception

inputSource

public abstract InputSource inputSource()
Returns the next input source.

Returns:
input source

buffer

public abstract BufferInput buffer()
                            throws IOException
Returns a buffered reader for the file.

Returns:
buffered reader
Throws:
IOException - I/O exception

merge

public abstract IO merge(String f)
Merges two filenames.

Parameters:
f - filename of the file
Returns:
contents

md

public boolean md()
Creates the directory.

Returns:
contents

dbname

public final String dbname()
Chops the path and the XML suffix of the specified filename and returns the database name. If no name can be extracted, "database" will be used as default name.

Returns:
database name

name

public final String name()
Chops the path of the specified filename.

Returns:
file name

path

public final String path()
Returns the path.

Returns:
path

url

public String url()
Creates a URL from the specified path.

Returns:
URL

dir

public String dir()
Returns the directory.

Returns:
chopped filename

children

public IO[] children()
Returns the children of a document.

Returns:
chopped filename

write

public void write(byte[] c)
           throws IOException
Writes the specified file contents.

Parameters:
c - contents
Throws:
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 String toString()
Overrides:
toString in class Object