java.lang.Object
|
+--stec.iws.IOHandler
public interface IOHandler
Defines methods used by iServer to access the file system.
Methods
Method
|
Description
|
exists
|
Returns whether the item exists.
|
getCanonicalPath
|
Returns the absolute path of an item.
|
getInputStream
|
Returns an InputStream to the item.
|
getItem
|
Used by iServer to retrieve an item.
|
isAbsolute
|
Returns whether the path to the item is an absolute path.
|
isDirectory
|
Returns whether the item referenced is a directory.
|
isFile
|
Returns whether the item referenced is a file.
|
lastModified
|
Returns the date that the item was last modified.
|
length
|
Returns the size of the item.
|
list
|
Returns an array of the names of the items contained in a directory.
|
exists
Returns whether the item exists.
Syntax
public abstract boolean exists()
Parameters
Returns
boolean
|
whether the item referenced exists.
|
Throws
Exception
|
any exception thrown.
|
Example
if(!fh.exists())
{
throw new FileNotFoundException();
}
getCanonicalPath
Returns the absolute path of an item.
Syntax
public abstract String getCanonicalPath() throws IOException
Parameters
Returns
String
|
the absolute path of the item referenced.
|
Throws
IOException
|
any IO exception thrown.
|
Example
String file = fh.getCanonicalPath();
getInputStream
Returns an InputStream to the item.
Syntax
public abstract InputStream getInputStream() throws IOException
Parameters
Returns
InputStream
|
the InputStream to the item.
|
Throws
IOException
|
any IO exception thrown.
|
Example
InputStream is = fh.getInputStream();
getItem
Used by iServer to retrieve an item.
Syntax
public abstract String getItem() throws IOException
Parameters
Returns
byte[]
|
a byte array containing the item referenced.
|
Throws
IOException
|
any IO exception thrown.
|
Example
byte[] item = fh.getItem();
isAbsolute
Returns whether the path to the item is an absolute path.
Syntax
public abstract boolean isAbsolute()
Parameters
Returns
boolean
|
whether the path to the item is an absolute path.
|
Throws
Exception
|
any exception thrown.
|
Example
if(!fh.isAbsolute())
{
filename = fh.getCanonicalPath();
}
isDirectory
Returns whether the item referenced is a directory.
Syntax
public abstract boolean isDirectory()
Parameters
Returns
boolean
|
whether the item referenced is a directory.
|
Throws
Exception
|
any exception thrown.
|
Example
String[] items = null;
if(fh.isDirectory())
{
items = fh.list();
}
isFile
Returns whether the item referenced is a file.
Syntax
public abstract boolean isFile()
Parameters
Returns
boolean
|
whether the item referenced is a file.
|
Throws
Exception
|
any exception thrown.
|
Example
String item;
if(fh.isFile())
{
item = Utils.getItem(fh.getInputStream());
}
else
{
item = "";
}
lastModified
Returns the date that the item was last modified.
Syntax
public abstract long lastModified()
Parameters
Returns
long
|
the time the item referenced was last modified.
|
Throws
Exception
|
any exception thrown.
|
Example
long timestamp = fh.lastModified();
length
Returns the size of the item.
Syntax
public abstract long length()
Parameters
Returns
long
|
the size in bytes of the item referenced.
|
Throws
Exception
|
any exception thrown.
|
Example
long length = fh.length();
list
Returns an array of the names of the items contained in a directory.
Syntax
public abstract String[] list()
Parameters
Returns
String[]
|
an array of Strings containing the names of the items contained within the directory referenced.
|
Throws
Exception
|
any exception thrown.
|
Example
String[] items = null;
if(fh.isDirectory())
{
items = fh.list();
}
|