The following code is extracted from the java web start chapter of the core java volume 1.
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream printOut = new PrintStream(out);
printOut.print(panel.getText());
//panel.getText() return a String
InputStream data = new ByteArrayInputStream(out.toByteArray());
FileSaveService service = (FileSaveService) ServiceManager
.lookup("javax.jnlp.FileSaveService");
service.saveFileDialog(".", new String[] { "txt" }, data, "calc.txt");
There are four objects created ,the stream is redirected three times. Is there any other methods to write data to a file by using jnlp api? what's the difference between InputStream and ByteArrayInputStream?