Servertec   IOHandler
Content
Introduction
Release Notes
Features
FAQs
Requirements
Installation
Add-ons
How To
Change Log
Future Plans
Knowledge Base
Documentation
Conventions
Users
Reference
iServer API
AccessLogEntry
Codecs
Connection
ConnectionPool...
DString
ErrorLogEntry
EventLogEntry
FileCache
FileUpload
IOHandler
IOManager
iws
Logger
MultiPartForm
QuickSort
QuickSortString...
Realm
RealmAdmin...
RealmManager
ServletContextImpl
ServletContext...
ServletImpl
ServletManager
Utils

Servlet API
CGI
SSI
Servlets
Config Files
Log Files
Classes
Directory Tree

Samples
Sales
Legal
Feedback

 

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

None

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

None

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

None

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

None

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

None

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

None

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

None

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

None

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

None

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

None

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();
}
 top of page
 Built with iScript Copyright © 1997-2000 Servertec. All rights reserved.
Last Modified: Thu Aug 10 13:06:59 EDT 2000