Hola,
I'm working on a personal-organizer applet and I'm having trouble saving my to-do lists. I want to save a vector that contains my table data as an object (don't feel like playing with text) and I'd like to save to the folder in my webspace where all of the applet files are (.class's, index.html, etc.).
At first I was getting "access denied" exceptions thrown at me, so I signed my .jar file. I then managed to figure out that I could use the <url>.openStream() method to load and also the URLconnection to get an output stream and now the load is working, but the save is not. It doesn't throw any exceptions or say that I'm doing anything wrong, but alas new items aren't being saved.
My save function:
public static void saveDataURL(URL u)
{
URLconnection urlCon= u.openConnection();
urlCon.setDoOutput(true);
urlCon.connect();
OutputStream fout = urlCon.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(<vector of data>);
oos.close();
}
I think the problem might have to do with the way I'm using an OutputStream instead of a FileOutputSteam as the argument when instantiating the ObjectOutputStream, but I could be wrong. (I modified this method to use URLS. When I was writing to the the local hard drive, I created a FileOutputStream from a File...)
I also tried something like
...
FileOutputStream fout = (FileOutputStream) urlCon.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(fout);
...but I believe the compiler didn't think that was too bright of an idea.
Any help would be appreciated. Any speed in replying would also be appreciated. I've had my applet working for quite some time, but I can't use it yet and am beginning to become frustrated.
Thanks.
George.