|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PenletStorage
PenletStorage represents the storage pool for Penlets.
Example:
PenletContext context = ...;
PenletStorage ps = context.getInternalPenletStorage();
InputStream in = ps.openInputStream("file.txt");
in.read(storedState);
in.close();
PenletStorage contain methods for:
| Method Summary | |
|---|---|
boolean |
createDir(String name)
Create a sub-directory to a PenletStorage pool directory |
boolean |
delete(String name)
Remove a PenletStorage pool item (file or directory) If the item is a directory, the directory and all its contents is removed |
boolean |
exists(String name)
Check if a PenletStorage pool item (file or directory) exists. |
DataSource |
getDataSource(String name)
Gets a DataSource object for the specified name. |
long |
getModifiedTime(String name)
Get the modified time for the file entry passed. |
Enumeration |
list(String name,
String filter,
boolean includeHidden)
List all the file entries within the directory name
specified. |
InputStream |
openInputStream(String name)
Open a PenletStorage input stream for reading. |
OutputStream |
openOutputStream(String name)
Open a PenletStorage output stream for writing. |
OutputStream |
openOutputStream(String name,
boolean append)
Open a PenletStorage output stream for writing (appending if append is true). |
| Method Detail |
|---|
InputStream openInputStream(String name)
throws IOException
name - is the name of the input stream
IOException - if an I/O error occurs.
OutputStream openOutputStream(String name)
throws IOException
name does not exist it is created. If the item exists its
content will be destroyed.
name - is the name of the output stream
IOException - if an I/O error occurs.
OutputStream openOutputStream(String name,
boolean append)
throws IOException
append is true). If the item with the name name does
not exist it is created. If the item exists and append is true, the content will be appended.
If append is false, the content will be destroyed.
name - is the name of the output streamappend - whether to append to the stream or write to the beginning
IOException - if an I/O error occurs.
boolean delete(String name)
throws IOException
name - is the name of the item to be removed
IOException - if an I/O error occurs.
boolean createDir(String name)
throws IOException
name - is the name of the directory to be created
IOException - if an I/O error occurs.
boolean exists(String name)
throws IOException
name - is the name of the item
IOException - if there was an I/O error.
long getModifiedTime(String name)
throws IOException
name - the file
IOException - if there was an I/O error.
Enumeration list(String name,
String filter,
boolean includeHidden)
throws IOException
name
specified. For example,
list("sessions", "*.dat", false)
lists all the dat files in the directory sessions.
name - directory name to the list the entries fromfilter - a string that filters the list of entries. It supports a
very basic endsWith pattern (*.xxx, endsWith xxx) and
startsWith pattern (yyy.*, startsWith yyy)includeHidden - boolean to indicate if hidden files should be
included in the filtered list.
IOException - if there was an I/O error.DataSource getDataSource(String name)
DataSource object for the specified name.
name - the data source name
DataSource for the specified name.
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||