Help me to Understand java.io package..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pjerald
    New Member
    • Oct 2007
    • 77

    Help me to Understand java.io package..

    I have many doubts regarding java.io package. let me list some..

    1) Here we have reader and writer, And OutputStream and InputStream abstract classes. what is the difference between these terms 'reader' and 'inputStream'
    2) i don have an idea when to use which classes.
    3) if there is any thumb rule for the usage of these class.. do reply to this thread.

    If my third question doesn't mean any thing sensible, please do ignore it.



    Thanks,
    P.Jerald
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by pjerald
    I have many doubts regarding java.io package. let me list some..

    1) Here we have reader and writer, And OutputStream and InputStream abstract classes. what is the difference between these terms 'reader' and 'inputStream'
    2) i don have an idea when to use which classes.
    3) if there is any thumb rule for the usage of these class.. do reply to this thread.

    If my third question doesn't mean any thing sensible, please do ignore it.



    Thanks,
    P.Jerald
    Streams are simply byte based,i.e.they don't try to convert bytes to unicode strings
    or anything. Readers and Writers are characters based and they do their best to
    convert those low level bytes to unicode characterrs.

    There are concrete subclasses for Streams, Readers and Writers available (see the
    API docs) and the entire IO stuff is based on the Decorator/Wrapper pattern.

    Basically you can use Streams for binary IO, Readers and Writers are just for
    character based IO.

    kind regards,

    Jos

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by pjerald
      I have many doubts regarding java.io package. let me list some..

      1) Here we have reader and writer, And OutputStream and InputStream abstract classes. what is the difference between these terms 'reader' and 'inputStream'
      2) i don have an idea when to use which classes.
      3) if there is any thumb rule for the usage of these class.. do reply to this thread.

      If my third question doesn't mean any thing sensible, please do ignore it.



      Thanks,
      P.Jerald
      Sun's tutorial should be able to shed some light.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by r035198x
        Sun's tutorial should be able to shed some light.
        r035198x, have a look what I did in the Java Articles section: we can refer to those
        external links through that little article again.

        kind regards,

        Jos

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by JosAH
          r035198x, have a look what I did in the Java Articles section: we can refer to those
          external links through that little article again.

          kind regards,

          Jos
          You must go into hiding quick. They're probably looking for you with their pink inflatable axes that go "beep"!

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by r035198x
            You must go into hiding quick. They're probably looking for you with their pink inflatable axes that go "beep"!
            But why? All I did was post a little article there with a funny title ...

            kind regards,

            Jos ;-)

            Comment

            Working...