Webstart demonstration:
http://kaioa.com/src/tools/MuffinStreamTest.jnlp
You’ll see a JFrame with a JTextArea and nothing else. Write something… close it and start it again. The text should be there again (loaded from a muffin).
The source:
http://kaioa.com/src/tools/MuffinStreamTest.java
http://kaioa.com/src/tools/MuffinOutputStream.java
http://kaioa.com/src/tools/MuffinInputStreamGetter.java
Showsrc-ified:
http://showsrc.com/$http://kaioa.com/src/tools/MuffinStreamTest.java
http://showsrc.com/$http://kaioa.com/src/tools/MuffinOutputStream.java
http://showsrc.com/$http://kaioa.com/src/tools/MuffinInputStreamGetter.java
On the first run the load method in MuffinStreamTest will end up in the catch block, because there isn’t a muffin.
Muffins should be nicer to handle with these two classes. It should be good enough for most of the webstart apps. It’s written somewhat simple minded, but why not?
Design-wise it’s asymetric - I’m very sorry (it just made more sense to handle it this way). One thing worth noting… the muffin itself is actually written in the close() method, because you need to know the maximum size of muffin before writing.
You’ll need either the webstart devkit (I used the jnlp.jar from “javaws-1_2-dev.zip”) or javaws.jar (from your javaws directory) in your classpath for compilation.
Condition of use/license:
a) don’t sue me
b) use it like you want to
c) change it like you want to
d) if you find bugs or ways to improve it, let me (us) know