File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "writing text file to outputstream" Watch "writing text file to outputstream" New topic

writing text file to outputstream

Ankit Chandrawat
Ranch Hand

Joined: Jan 03, 2008
Posts: 88

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.

Ankit Chandrawat

[Download view.bmp] Download

John de Michele

Joined: Mar 09, 2009
Posts: 600

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

I agree. Here's the link:
subject: writing text file to outputstream
jQuery in Action, 3rd edition