| Documentation Contents

# Applet Persistence API

Beginning with JDK 1.4, two new methods have been added to interface `java.Applet.AppletContext` to allow applet persistence across browser sessions. These methods are:

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

These new methods enable the applet developer 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.

See the API specification for more information

Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved. Please send comments using this Feedback page. | Java Technology