Solved

RandomAccessFile

Posted on 1998-11-15
4
211 Views
Last Modified: 2012-06-21

For RandomAccessFile, there is a writeUTF() method.  Is there just a plain writeString() or writeln() method, or a way to implement such a thing using RandomAccessFile (I like the ability to both read and write and append using the same stream, but in this case I just want to work with text files)?  There is a writeChars(), but it writes a string of chars, with a space between each, so it isn't quite what I'm looking for.

Thanks for any help!


ap9
0
Comment
Question by:ap9
  • 3
4 Comments
 
LVL 2

Expert Comment

by:vendrig
ID: 1227487
Try writeBytes. A weird name, but you can give a String value for parameter and it's written as a string to file (so you can read it in your ASCII editor). Use "\n" for new line.
0
 

Author Comment

by:ap9
ID: 1227488
Works great!  How can I credit you?  Can you repost that as an answer?


AP9
0
 
LVL 2

Accepted Solution

by:
vendrig earned 40 total points
ID: 1227489
Comment reposted as answer:
Try writeBytes. A weird name, but you can give a String value for parameter and it's written as a string to file (so you can read it in your ASCII editor). Use "\n" for new line.
0
 
LVL 2

Expert Comment

by:vendrig
ID: 1227490
Yeah, the name is real confusing. It took me some time to find that function ("but I don't want to write bytes, I want to write strings!";-) Good luck with it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now