Documentation Contents

# Applet Persistence API

Java Rich Internet Applications Guide > Enhancements and Other Features > Applet Persistence API

Two methods in the interface `java.Applet.AppletContext` enable applet persistence across browser sessions:

- `setStream(String key, InputStream stream)`
- `getStream(String key)`

These methods enable you to stream data and objects from one browser session so that they can be reused in subsequent browser sessions. This provides applet persistence and makes it unnecessary to use static objects in applets for this same purpose.

`setStream(key, stream)` maps a key to a stream. `getStream(key)` returns the stream mapped to the key. If the AppletContext already has a stream mapped to the key when `setStream(key, stream)` is invoked, the mapping is updated.

Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.
Contact Us