View Single Post
  #4   Spotlight this post!  
Unread 07-04-2010, 23:20
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: file i/o in java

I'll second Ron's approach.

As an FYI, once you have an OutputStream to the file, you can wrap it with a PrintStream and use the typical print methods on the file.


Quote:
PrintStream out;
DataOutputStream theFile;
FileConnection fc;

try {
fc = (FileConnection)Connector.open("file:///output.txt", Connector.WRITE);
fc.create();
theFile = fc.openDataOutputStream();
out = new PrintStream(theFile);
} catch (Exception e) {
...
}

Last edited by derekwhite : 07-04-2010 at 23:23. Reason: typo
Reply With Quote