Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-22-2008, 09:19 PM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default Writing UTF to file using writeUTF
The snippet below shows how to write UTF to file.

Code:
try{
//opens the file
DataOutputStream out = new DataOutputStream(new FileOutputStream(myfile.dat);
String theText = "William_Wilson. §"
out.writeUTF(theText);
out.writeUTF("\n-William Wilson. §");
//closes the file
out.close();
}
catch(Exception ex) {
System.out.println("Error Saving Text File");
JOptionPane.showMessageDialog(view, "The File cannot be saved.",
"Information", JOptionPane.INFORMATION_MESSAGE);
}
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
writing and reading unicode characters from a file ranoosh Advanced Java 4 09-28-2008 05:34 AM
Writing to a file (at the end) Java Tip Java Tips 0 02-08-2008 10:22 AM
writing to a file bugger New To Java 1 11-11-2007 03:49 AM
Help with File reading and writing baltimore New To Java 1 07-31-2007 07:47 PM
writing to a excel file from java program priyankabhar New To Java 1 07-10-2007 09:05 PM


All times are GMT +2. The time now is 07:09 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org