*
The moose likes I/O and Streams and the fly likes Basic: How IO reads or write ByteStream and CharacterStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Basic: How IO reads or write ByteStream and CharacterStream" Watch "Basic: How IO reads or write ByteStream and CharacterStream" New topic
Author

Basic: How IO reads or write ByteStream and CharacterStream

Doku Kol
Greenhorn

Joined: Aug 24, 2011
Posts: 3
I tried to read a "Dodo.bmp" file and create a copy of the file "CopyDodo.bmp".

Now I implemented in two ways first by read and writing as Byte Stream


and then I implemented using Character Stream



In both the case it creates a copy file and its viewable. But it should not have worked for Character Stream(i.e. 2nd program) as it reads the file as character and .bmp file has no character in it. It is a bmp file which is structure of binary
Please correct me, I am getting confused in this part?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

I don't see a BMP file, only an RTF file, and RTF files are actually text files with special formatting (like HTML files).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Doku Kol
Greenhorn

Joined: Aug 24, 2011
Posts: 3
whether it is bmp or rtf, I wanted to know how it reads. If it reads as binary, then do it read as "0101010....." ways and if reads as character then how will it read. I thought that by character reading we can read any txt document file and with binary we are suppose to read file as binary. Please explain that..
Doku Kol
Greenhorn

Joined: Aug 24, 2011
Posts: 3
Anyone please help me on the topic , how IO reads ?
Rajesh Rajamanickam
Greenhorn

Joined: Aug 10, 2011
Posts: 2

HI,

Character Streams are built on top of Byte Streams.So even is you read/write character stream it will convert into byte streams at the end.


please see the IO api for character Streams.

Regards
Rajesh R
 
GeeCON Prague 2014
 
subject: Basic: How IO reads or write ByteStream and CharacterStream