jQuery in Action, 3rd edition
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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: http://aspose.com/file-tools
subject: writing text file to outputstream
It's not a secret anymore!