IntelliJ Java IDE
The moose likes Java in General and the fly likes Outputfiles to an outputStream in their Original text format Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Outputfiles to an outputStream in their Original text format" Watch "Outputfiles to an outputStream in their Original text format" New topic
Author

Outputfiles to an outputStream in their Original text format

Stanley Mungai
Ranch Hand

Joined: Dec 09, 2011
Posts: 91

The code I have here Outputs these text files into Pdf Files because I have used a PdfWriter. Is there a way of Using A BufferedWriter to Output these Files by their Original text Format? Here is the code am using:



The Input Directory C:/Temporary Contains Text files. I need the to be Output into C:/Statements directory In their Original text format. Please Help.


Give a beggar a fish; feed him for a day. Teach him how to fish; Feed him for a lifetime.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 3143
Stanley Mungai wrote:The code I have here Outputs these text files into Pdf Files because I have used a PdfWriter.


Given this...

Is there a way of Using A BufferedWriter to Output these Files by their Original text Format?


...I would think the answer to this would be obvious.
Stanley Mungai
Ranch Hand

Joined: Dec 09, 2011
Posts: 91

Jeff, it is not obvious, I want to know how to connect a Buffered Writer (then) with an outputStream.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 3143
Stanley Mungai wrote:Jeff, it is not obvious, I want to know how to connect a Buffered Writer (then) with an outputStream.


If it were me, and I were just copying a file, any old file, I wouldn't use readers and writers at all. I'd just use FileInputStream and FileOutputStream. If I wanted specifically to copy a text file, there would also be the option of using FileReader and FileWriter, wrapped in BufferedReader and BufferedWriter.

If I had to connect a BufferedWriter with an OutputStream (which isn't really necessary here), I'd use an OuputStreamWriter in the middle.

Stanley Mungai
Ranch Hand

Joined: Dec 09, 2011
Posts: 91

Yep, That OutputStreamWriter Works pretty fine with my Situation something like:

Stanley Mungai
Ranch Hand

Joined: Dec 09, 2011
Posts: 91

Thank you.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 3143
You're welcome!

And welcome to the Ranch!
 
IntelliJ Java IDE
 
subject: Outputfiles to an outputStream in their Original text format
 
Threads others viewed
Pdf opens blank in browser
Merging byte arrays using SequenceInputStream
My program is not reading the first Line of a text file..What could be the issue: Here is the code:
How do I make the image Display on my PDf Document
read and write from txt file
IntelliJ Java IDE