• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Basic: How IO reads or write ByteStream and CharacterStream  RSS feed

 
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?
 
Sheriff
Posts: 21461
96
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 ?
 
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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!