Jump to content
  • Advertisement
Sign in to follow this  
saruthemonkey

[java] Signed applet writing to file

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

If you intended to correct an error in the post then please contact us.

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 this post


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

Share this post


Link to post
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 this post


Link to post
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));

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!