|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gwt.storage.client.Storage
public final class Storage
Implements the HTML5 Storage interface.
You can obtain a Storage by either invoking
getLocalStorageIfSupported()
or
getSessionStorageIfSupported()
.
Experimental API: This API is still under development and is subject to change.
If Web Storage is NOT supported in the browser, these methods return
null
.
Note: Storage events into other windows are not supported.
This may not be supported on all browsers.
Field Summary | |
---|---|
(package private) static StorageImpl |
impl
|
Method Summary | |
---|---|
static HandlerRegistration |
addStorageEventHandler(StorageEvent.Handler handler)
Registers an event handler for StorageEvents. |
void |
clear()
Removes all items in the Storage. |
java.lang.String |
getItem(java.lang.String key)
Returns the item in the Storage associated with the specified key. |
int |
getLength()
Returns the number of items in this Storage. |
static Storage |
getLocalStorageIfSupported()
Returns a Local Storage. |
static Storage |
getSessionStorageIfSupported()
Returns a Session Storage. |
static boolean |
isLocalStorageSupported()
Returns true if the localStorage part of the
Storage API is supported on the running platform. |
static boolean |
isSessionStorageSupported()
Returns true if the sessionStorage part of the
Storage API is supported on the running platform. |
static boolean |
isSupported()
Returns true if the Storage API (both localStorage and
sessionStorage) is supported on the running platform. |
java.lang.String |
key(int index)
Returns the key at the specified index. |
void |
removeItem(java.lang.String key)
Removes the item in the Storage associated with the specified key. |
static void |
removeStorageEventHandler(StorageEvent.Handler handler)
De-registers an event handler for StorageEvents. |
void |
setItem(java.lang.String key,
java.lang.String data)
Sets the value in the Storage associated with the specified key to the specified data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final StorageImpl impl
Method Detail |
---|
public static HandlerRegistration addStorageEventHandler(StorageEvent.Handler handler)
handler
-
HandlerRegistration
used to remove this handlerpublic static Storage getLocalStorageIfSupported()
The returned storage is associated with the origin of the Document.
null
if Web Storage is
NOT supported.public static Storage getSessionStorageIfSupported()
The returned storage is associated with the current top-level browsing context.
null
if Web Storage is
NOT supported.public static boolean isLocalStorageSupported()
true
if the localStorage
part of the
Storage API is supported on the running platform.
public static boolean isSessionStorageSupported()
true
if the sessionStorage
part of the
Storage API is supported on the running platform.
public static boolean isSupported()
true
if the Storage API (both localStorage and
sessionStorage) is supported on the running platform.
public static void removeStorageEventHandler(StorageEvent.Handler handler)
handler
- public void clear()
public java.lang.String getItem(java.lang.String key)
key
- the key to a value in the Storage
public int getLength()
public java.lang.String key(int index)
index
- the index of the key
public void removeItem(java.lang.String key)
key
- the key to a value in the Storagepublic void setItem(java.lang.String key, java.lang.String data)
key
- the key to a value in the Storagedata
- the value associated with the key
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |