|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.application.AbstractBean
org.jdesktop.application.LocalStorage
public class LocalStorage
Access to per application, per user, local file storage.
ApplicationContext.getLocalStorage(),
SessionStorage| Constructor Summary | |
|---|---|
protected |
LocalStorage(ApplicationContext context)
|
| Method Summary | |
|---|---|
boolean |
deleteFile(java.lang.String fileName)
Deletes the entry specified by the name parameter. |
protected ApplicationContext |
getContext()
|
java.io.File |
getDirectory()
Returns the directory where the local storage is located |
long |
getStorageLimit()
Gets the limit of the local storage |
java.lang.Object |
load(java.lang.String fileName)
Loads the been from the local storage |
java.io.InputStream |
openInputFile(java.lang.String fileName)
Opens an input stream to read from the entry specified by the name parameter. |
java.io.OutputStream |
openOutputFile(java.lang.String fileName)
Opens an output stream to write to the entry specified by the name parameter. |
java.io.OutputStream |
openOutputFile(java.lang.String fileName,
boolean append)
Opens an output stream to write to the entry specified by the name parameter. |
void |
save(java.lang.Object bean,
java.lang.String fileName)
Saves the bean to the local storage |
void |
setDirectory(java.io.File directory)
Sets the location of the local storage |
void |
setStorageLimit(long storageLimit)
Sets the limit of the lical storage |
| Methods inherited from class org.jdesktop.application.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected LocalStorage(ApplicationContext context)
| Method Detail |
|---|
protected final ApplicationContext getContext()
public java.io.InputStream openInputFile(java.lang.String fileName)
throws java.io.IOException
name parameter.
If the named entry cannot be opened for reading
then a IOException is thrown.
fileName - the storage-dependent name
InputStream object
java.io.IOException - if the specified name is invalid,
or an input stream cannot be opened
public java.io.OutputStream openOutputFile(java.lang.String fileName)
throws java.io.IOException
name parameter.
If the named entry cannot be opened for writing
then a IOException is thrown.
If the named entry does not exist it can be created.
The entry will be recreated if already exists.
fileName - the storage-dependent name
OutputStream object
java.io.IOException - if the specified name is invalid,
or an output stream cannot be opened
public java.io.OutputStream openOutputFile(java.lang.String fileName,
boolean append)
throws java.io.IOException
name parameter.
If the named entry cannot be opened for writing
then a IOException is thrown.
If the named entry does not exist it can be created.
You can decide whether data will be appended via append parameter.
fileName - the storage-dependent nameappend - if true, then bytes will be written
to the end of the output entry rather than the beginning
OutputStream object
java.io.IOException - if the specified name is invalid,
or an output stream cannot be opened
public boolean deleteFile(java.lang.String fileName)
throws java.io.IOException
name parameter.
fileName - the storage-dependent name
java.io.IOException - if the specified name is invalid,
or an internal entry cannot be deleted
public void save(java.lang.Object bean,
java.lang.String fileName)
throws java.io.IOException
bean to the local storage
bean - the object ot be savedfileName - the targen file name
java.io.IOException
public java.lang.Object load(java.lang.String fileName)
throws java.io.IOException
fileName - name of the file to be read from
java.io.IOExceptionpublic long getStorageLimit()
public void setStorageLimit(long storageLimit)
storageLimit - the limit of the lical storagepublic java.io.File getDirectory()
public void setDirectory(java.io.File directory)
directory - the location of the local storage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||