Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven


Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi folks,
i found the following about the InputStreamReader:
i don't really understand when it says from bytes to it true that everything written in console is byte that needs to be converted in characters like shown in above code snippet? it would be great help if you explain me this concept in layman's term.
[ July 07, 2003: Message edited by: Namaste Sathi ]
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi sathi
here is what i understand.
Byte streams can work with any streams (as anything essentially is a byte format).
Character streams is a easy way of handling data "if we know the data is character data".
- if we wonna read image then we don't use Character stream as u can't really print image the way u 'd display characters, right?
- if we wonna read a file that has some user data which is a text then we use Character stream rather than the Byte stream to have greater advantage of methods like readLine() and things...
now, when we need InputStreamReader()???
when the input source can't be predicted till runtime the API methods (java api or custom api) can return byte stream object as we can read any data with byte streams BUT if we know (being in specific application) that the input is always a file having ascii characters then we can use InputStreamReader as bridge b/w byte stream that we get from the API method and the Readers we have in our code to deal input data as characters.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic