aspose file tools
The moose likes Beginning Java and the fly likes How can I display the contents of a file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "How can I display the contents of a file" Watch "How can I display the contents of a file" New topic
Author

How can I display the contents of a file

ksparwez
Greenhorn

Joined: Sep 25, 2000
Posts: 2
Hi all,
I have a task which involves opening a Java Source file into a text area. Iam trying to use the Input and Output streams to do so. Will this work out? If so could anyone please tell me how. How should I use the Inputstream to capture the contents of the file and then How should I Display the contents in a text area. Later on I should be able to modify the contents of the text area. Can anyone please tell me how to do this?
Thanx
Parwez
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Here is an example that's available with JBuilder 3.0.

Hope this helps

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Harish Kashyap
Ranch Hand

Joined: Jun 14, 2000
Posts: 118
here's solution for u
try{
BufferedReader in = new BufferedReader(new FileReader(filename));
while((str=in.readLine())!=null)
textarea.append("\n"+str);
in.close();
}catch(IOException e)
{textarea.setText(e.getMessage());}
this much will work.
harish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I display the contents of a file
 
Similar Threads
Displaying file content in a jsp page
To retrieve the contents of an xml file in JMS
changing displayed text in addressbar,locationbar
display contents of a text file in a new window
Help about JTextArea in applet!