[java] Signed applet writing to file

Started by
2 comments, last by Jebediah 18 years, 9 months ago
I have a signed applet, and I'm trying to either create a .dat or .txt file or access one that's already there on a website. It's just flat out not working though.. Should I use a URLConnection? And what should I use to write to the file? Thanks for the help.
Advertisement
Well, basically you just create a FileWriter (using the filename in its constructor) and write something to it:

FileWriter fw = new FileWriter("myFile.txt");fw.write(...);fw.close();
Not quite that easy I'm afraid. I've already tried output streams, buffered writers and the like. When I didn't specify a URL to write to, it wrote to my AOL downloaded content folder, and the webmaster's mozilla folder. I know how to read and write to files normally, but when it's online it doesn't quite seem to work. Thanks for you reply though.

URL url;StringBuffer buffer;int responseCode;HttpURLConnection connection = null;InputStream input;BufferedReader bReader;url = new URL(filename);connection = (HttpURLConnection) url.openConnection();responseCode = connection.getResponseCode();buffer = new StringBuffer();input = connection.getInputStream();bReader = new BufferedReader(new InputStreamReader(input));

This topic is closed to new replies.

Advertisement