• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Basic: How IO reads or write ByteStream and CharacterStream

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22262
119
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone please help me on the topic , how IO reads ?
 
Greenhorn
Posts: 2
Oracle Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic