The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
March 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

java.io.*? problem ?

Posted by ida on December 24, 2001 at 6:54 AM

> > I want to know if it is possible to read a whole file once into
> > a string or into a char array ( not byte[] ).
> > If it isn't possible , since I know how to read the file once into
> > a byte array, so is there anyway to convert a byte array to a char
> > array ?

> Yes. I've done this before. Create a StringBuffer to hold your data and a BufferedReader to read it in. Then, write a loop that uses readLine() to read in each line of data and append it to what you've already read.






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us