Solved

RandomAccessFile

Posted on 1998-11-15
4
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

695 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