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
Returns
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
Returns
Throws
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
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
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
Returns
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
Returns
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
Returns
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
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
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());
|