[java] Signed applet writing to file

This topic is 4859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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.

Share on other sites
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();

Share on other sites
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.

Share on other sites

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));

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 16
• 14
• 9
• 9
• 9
• Forum Statistics

• Total Topics
632928
• Total Posts
3009268
• Who's Online (See full list)

There are no registered users currently online

×