This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes writing text file to outputstream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "writing text file to outputstream" Watch "writing text file to outputstream" New topic
Author

writing text file to outputstream

Ankit Chandrawat
Ranch Hand

Joined: Jan 03, 2008
Posts: 87
Hi,

I have a text file that I want to read and write it to outputstream. For that I am using ByteArrayOutputStream. The text file should be read line by line and after each line a linebreak character should be inserted. How can I implement this. Also is there any other better way through which I can achieve the same. Attached is the image showing how it is being displayed now.

TIA,
Ankit Chandrawat


[Download view.bmp] Download

John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Ankit:

Googling 'java io outputstream tutorial' will give you several examples.

John.
 
Consider Paul's rocket mass heater.
 
subject: writing text file to outputstream
 
Similar Threads
save a file, in a different subdirectory
how to read lines in BuffredReader
Reading the file
Call to Servlet with InputStream from application
Reading second in a text file