How can I save applet state?

An applet persistence API was introduced some time ago with JDK 1.4, offering three methods of the java.applet.AppletContext interface: setStream(), getStream(), and getStreamKeys(). Use the setStream() method to save state, the getStream() method to retrieve it, and the getStreamKeys() to get an Iterator of the keys for streams that store state.