Servertec api_iwsStorage
Documentation
Conventions
Command Line
Java API
AccessLogEntry
Codecs
DString
ErrorLogEntry
EventLogEntry
iws
iwsStorage
Logger
ServletManager
Utils

Servlet API
Servlets
Config Files
Log Files
Classes
Directory Tree

Return

 

java.lang.Object
 |
 +--stec.iws.iwsStorage

public final class iwsStorage

Servertec's Virtual File System for embedded devices.

Methods

Method Description
exists Returns whether a file or directory exists at the specified path.
getParent Returns the parent directory of the specified path.
isDirectory Returns whether a directory exists at the specified path.
list Returns an array of Strings of all the entries at the specified directory path.
load Returns the file at the existing specified path as a byte array.
md Used to create the specified new directory.
rd Used to remove the specified exiting directory.
rm Used to remove the specified exiting file.
store Inserts a new file or updates the existing file at the specified path with the specified byte array.

Notes

When the server starts files and directories in iws_dir\build\storage converted into classes by build_iws are loaded into memory.

Changes made to the file system im memory image while the server is running will ot persist and will be lost when then server is stopped or goes down.


exists

Returns whether a file or directory exists at the specified path.

Syntax

public final static void md(String path) throws IOException

Parameters

path the directory path.

Returns

Nothing

Throws

IOExcepton If a file exists at the specified path, if the parent directory does not exist, if the parent is not a directory or if any errors occur.

Example

iwsStorage.md("/images");

getParent

Returns the parent directory of the specified path.

Syntax

public final static String getParent(String path)

Parameters

path the path.

Returns

Nothing

Throws

Nothing.

Example

String dir = iwsStorage.getParent("/wwwroot/index.html");

isDirectory

Returns whether a directory exists at the specified path.

Syntax

public final static boolean isDirectory(String path) throws IOException

Parameters

path the path to check.

Returns

boolean whether a directory exists at the specified path.

Throws

IOExcepton If any errors occur.

Example

boolean isdirectory = iwsStorage.isDirectory("/images");

list

Returns an array of Strings of all the entries at the specified directory path.

Syntax

public final static String[] list(String path) throws IOException

Parameters

path the directory path.

Returns

String[] an array of Strings containing all the entries at the specified directory path.

Throws

IOExcepton If the directory does not exist or if any errors occur.

Example

String[] list = iwsStorage.list("/images");

load

Returns the file at the existing specified path as a byte array.

Syntax

public final static byte[] load(String path) throws IOException

Parameters

path the directory path.

Returns

byte[] a byte array.

Throws

IOExcepton If the specified path is a directory, if the parent directory does not exist, if the parent is not a directory or if any errors occur.

Example

byte[] page = iwsStorage.load("/wwwroot/index.html");

md

Used to create the specified new directory.

Syntax

public final static void md(String path) throws IOException

Parameters

path the directory path.

Returns

Nothing.

Throws

IOExcepton If a file exists at the specified path, if the parent directory does not exist, if the parent is not a directory or if any errors occur.

Example

iwsStorage.md("/images");

rd

Used to remove the specified exiting directory.

Syntax

public final static void rd(String path) throws IOException

Parameters

path the directory path.

Returns

Nothing.

Throws

IOExcepton If the specified path is not a directory, if the parent directory does not exist, if the parent is not a directory or if any errors occur.

Example

iwsStorage.rd("/images");

rm

Used to remove the specified exiting file.

Syntax

public final static void rm(String path) throws IOException

Parameters

path the path to the file to remove.

Returns

Nothing.

Throws

IOExcepton If the specified path is a directory, if the parent directory does not exist, if the parent is not a directory or if any errors occur.

Example

iwsStorage.rm("/wwwroot/index.html");

store

Inserts a new file or updates the existing file at the specified path with the specified byte array.

Syntax

public final static void store(String path, byte[] bytes) throws IOException

Parameters

path the directory path.
btyes the byte array.

Returns

Nothing.

Throws

IOExcepton If the specified path is a directory, if the parent directory does not exist, if the parent is not a directory or if any errors occur.

Example

iwsStorage.store("/wwwroot/index.html", page.getBytes());
 top of page
Copyright © 1998-2005 Servertec. All rights reserved.
Privacy Statement.
Last Modified: Mon Sep 05 14:25:47 EDT 2005