• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

urgent query - diff b/w byte streams and characters streams

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai,
please respond to my query

diff b/w byte streams and characters streams. and for what purpose
the both are used. and which stream is efficient.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a Sun Tutorial on the topic. The page after this one shows reading non-unicode bytes such as ASCII into unicode characters and writing them back out.
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

the byte stream is used in order to read the input byte by byte
and character stream for reading charcter by character

byte stream is more efficient since it is fast
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by naveen gupta:

byte stream is more efficient since it is fast



It is not that simple. The most efficient stream depends on what your requirements are. If you need to process character data, a byte stream may get the data faster but you still need to translate bytes into characters, which makes the difference moot. One should also consider speed of development and ease of maintainance. Why should I code something to translate bytes into characters when there's a class that does it already?
The book Java Platform Performance descibes strategies for measuring performance and the basics on writing efficient Java code. The most important step is the first one, defining your requirements so you know what "efficient" is for your circumstances.
 
reply
    Bookmark Topic Watch Topic
  • New Topic