• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic: How IO reads or write ByteStream and CharacterStream

 
Doku Kol
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see a BMP file, only an RTF file, and RTF files are actually text files with special formatting (like HTML files).
 
Doku Kol
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone please help me on the topic , how IO reads ?
 
Rajesh Rajamanickam
Greenhorn
Posts: 2
Java Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic