|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.io.IO
public abstract class IO
Generic representation for inputs and outputs. The underlying source can
be a local file (IOFile
), a URL (IOUrl
), a byte array
(IOContent
), or a stream (IOStream
).
Field Summary | |
---|---|
static java.lang.String |
BASEXSUFFIX
Database file suffix. |
static int |
BLOCKSIZE
Disk block/page size (4096). |
static java.lang.String |
BXSSUFFIX
Command script suffix. |
static java.lang.String |
CSVSUFFIX
CSV file suffix. |
static int |
ENTRIES
Entries per block (256). |
static java.lang.String |
FILEPREF
File prefix. |
static java.lang.String |
GZSUFFIX
GZIP file suffix. |
static java.lang.String[] |
HTMLSUFFIXES
HTML suffixes. |
static java.lang.String |
JARSUFFIX
JAR file suffix. |
static java.lang.String |
JSONSUFFIX
JSON file suffix. |
static java.lang.String |
LOGSUFFIX
XQuery log suffix. |
static int |
MAXATTS
Maximum number of attributes (see bit layout in Data class). |
static int |
NODEPOWER
Table node size power (4). |
static int |
NODESIZE
Table node size power (16). |
static long |
OFFCOMP
Offset for compressing texts (see bit layout in Data class). |
static long |
OFFNUM
Offset for inlining numbers (see bit layout in Data class). |
static java.lang.String[] |
TXTSUFFIXES
Text suffixes. |
static java.lang.String |
XARSUFFIX
XAR file suffix. |
static java.lang.String |
XMLSUFFIX
XML file suffix. |
static java.lang.String[] |
XMLSUFFIXES
XML suffixes. |
static java.lang.String |
XQMSUFFIX
XQuery module suffix. |
static java.lang.String |
XQSUFFIX
XQuery file suffix. |
static java.lang.String[] |
XQSUFFIXES
XQuery suffixes. |
static java.lang.String[] |
XSLSUFFIXES
XML suffixes. |
static java.lang.String |
ZIPSUFFIX
ZIP file suffix. |
static java.lang.String[] |
ZIPSUFFIXES
ZIP suffixes. |
Method Summary | |
---|---|
java.lang.String |
dbname()
Chops the path and the file suffix of the specified filename and returns the database name. |
java.lang.String |
dirPath()
Returns the directory path. |
boolean |
eq(IO io)
Compares the filename of the specified IO reference. |
boolean |
exists()
Tests if the reference exists. |
static IO |
get(java.lang.String source)
Returns a class instance for the specified string. |
boolean |
hasSuffix(java.lang.String... suffixes)
Tests if the file suffix matches the specified suffixes. |
abstract org.xml.sax.InputSource |
inputSource()
Returns an input source. |
abstract java.io.InputStream |
inputStream()
Returns an input stream. |
boolean |
isArchive()
Checks if this file is an archive. |
boolean |
isDir()
Tests if this is a directory instance. |
long |
length()
Returns the file length. |
void |
length(long l)
Sets the input length. |
IO |
merge(java.lang.String in)
Merges two paths. |
java.lang.String |
name()
Returns the name of the resource. |
void |
name(java.lang.String n)
Sets the name of the resource. |
java.lang.String |
path()
Returns the path. |
abstract byte[] |
read()
Returns the binary contents. |
abstract javax.xml.transform.stream.StreamSource |
streamSource()
Returns a stream source. |
java.lang.String |
string()
Returns the contents as string. |
static java.lang.String |
suffix(java.lang.String path)
Returns the suffix of the specified path in lower case. |
long |
timeStamp()
Returns the time stamp (modification date) of this file. |
java.lang.String |
toString()
|
java.lang.String |
url()
Creates a URL from the specified path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String BASEXSUFFIX
public static final java.lang.String BXSSUFFIX
public static final java.lang.String XQSUFFIX
public static final java.lang.String XQMSUFFIX
public static final java.lang.String XMLSUFFIX
public static final java.lang.String ZIPSUFFIX
public static final java.lang.String CSVSUFFIX
public static final java.lang.String JSONSUFFIX
public static final java.lang.String JARSUFFIX
public static final java.lang.String GZSUFFIX
public static final java.lang.String XARSUFFIX
public static final java.lang.String LOGSUFFIX
public static final java.lang.String FILEPREF
public static final java.lang.String[] XQSUFFIXES
public static final java.lang.String[] ZIPSUFFIXES
public static final java.lang.String[] XMLSUFFIXES
public static final java.lang.String[] XSLSUFFIXES
public static final java.lang.String[] HTMLSUFFIXES
public static final java.lang.String[] TXTSUFFIXES
public static final int BLOCKSIZE
public static final int NODEPOWER
public static final int NODESIZE
public static final int ENTRIES
public static final int MAXATTS
Data
class).
public static final long OFFNUM
Data
class).
public static final long OFFCOMP
Data
class).
Method Detail |
---|
public static IO get(java.lang.String source)
Returns a class instance for the specified string. The type of the returned instance depends on the string value:
IOFile
: if the string starts with file:
, or if it
does not contain the substring ://
, it is interpreted as
local file instanceIOUrl
: if it starts with a valid scheme, it is handled as URLIOContent
: otherwise, it is interpreted as XML fragment and internally
represented as byte array
source
- source string
public abstract byte[] read() throws java.io.IOException
java.io.IOException
- I/O exceptionpublic final java.lang.String string() throws java.io.IOException
java.io.IOException
- I/O exceptionpublic boolean exists()
true
for IO instances other than IOFile
.
public boolean isDir()
false
for IO instances other than IOFile
.
public boolean hasSuffix(java.lang.String... suffixes)
suffixes
- suffixes to compare with
public long timeStamp()
IOFile
.
public void length(long l)
l
- lengthpublic long length()
public abstract org.xml.sax.InputSource inputSource()
public abstract javax.xml.transform.stream.StreamSource streamSource()
public abstract java.io.InputStream inputStream() throws java.io.IOException
java.io.IOException
- I/O exceptionpublic IO merge(java.lang.String in)
IOContent
and
IOStream
instances.
in
- name/path to be appended
public final boolean isArchive()
public final java.lang.String dbname()
public final java.lang.String name()
public final void name(java.lang.String n)
n
- file namepublic final java.lang.String path()
public java.lang.String url()
IOFile
.
public java.lang.String dirPath()
public boolean eq(IO io)
io
- io reference
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String suffix(java.lang.String path)
path
- path to be checked
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |