Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

true/false

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following statements are true?
A. Java uses a system called UTF for I/O to support
international character sets //true
B. The RandomAccessFile is the most suitable class
for supporting international character sets
C. An instance of FileInputStream may not be chained to
an instance of FileOutputStream //true
D. File I/O activities requires use of Exception handling //true
Can any one help me to understand answer C ?
Thanks in advance.
 
Trailboss
Posts: 23211
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a pipe construct so you can connect an InputStream to an OutputStream. I can't remember what it is called, but I do know that I used it once.
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Umesh,
I waited for someone to respond. Ok. Here is some thought.
A. Java uses a system called UTF for I/O to support international character sets
True. Java uses a conversion method called UTF-8 which is a subset of UTF. Subset in the sense, in true UTF a char can be encoded from 1 byte to ANY no of bytes. This means we can cover ALL CHARS IN ALL LANGUAGES IN THE WORLD. So UTF is true transformation. This means a small char can have lesser no of bytes , at the same time a BIG-LOOK&FEEL ( ) asian char may be encoded with many no. of bytes. Since in Java all chars can have max 16 bits,(Unicode char) , All IO operations which need char transformation of bytes (All readers/writers) uses a pre-defined transformation format. (i.e) a char can be encoded to 1 or 2 or 3 bytes ONLY . max 3 bytes. There are some rules which chars are encoded with how many no of bytes. It is in Java Doc. I also found a error in Bill brogden's book recently here which illustrates this concept.

B. The RandomAccessFile is the most suitable class for supporting international character sets
False. All locale related needs are dealt with Readers/Writers and theri subclasses

C. An instance of FileInputStream may not be chained to an instance of FileOutputStream

True. FileOutputStream class take the args only in the form of (String filename) / (File file) / (FileDescripter fd )/( String filename, boolean append) format. If you take all OutputStream classes, Most of them (except PipedOutputStream ) does not take an InputStream object an arg to their constructor. We can say a PipedOutputSteam is an OutputStream, but can we say all OutputStreams are PipedOutputStream ? We can't generalize like that. So the this answer is true
.
D. File I/O activities requires use of Exception handling
True. Most of read/write IO operation are inherited from the abstract InputStream/OutputStream classes. And all (as far as I checked ) the subclasses which override them throws IOException . So this is true.
regds
maha anna

[This message has been edited by maha anna (edited April 14, 2000).]
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic