File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes read line by line from file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "read line by line from file" Watch "read line by line from file" New topic
Author

read line by line from file

mahdi farzami
Ranch Hand

Joined: Nov 21, 2009
Posts: 32
Hi , how can i read a file line by line ???
i want to save each line in slot of String array
i write this code but it`s return all of file !!!
please help me to change this code
thanks
Gopinath Karyadath
Ranch Hand

Joined: Oct 14, 2009
Posts: 87
Dear friend


String des=""
Vector vector = new Vector ();

while ((ch = isr.read()) > -1) {
buffer.append( (char) ch ) ;





des+= (String) (char) ch ;
if ( (char) ch == '\n' ) {
vector.addelements(des) ;
des = "" ;

}


}


regards
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: read line by line from file
 
Similar Threads
Can Someone Help with Reading from a text file in J2ME
Writing from a midlet to a file
HOW TO COMMUNICATE JAVA APPLICATION TO SERVLETS
How to send bytearray from Servlet to Midlet application?
How to write to a file?