what is the different between byte stream and character stream?

Discussion in 'Java' started by dolphin, Mar 17, 2007.

  1. dolphin

    dolphin Guest

    Hi !what is the different between byte stream and character stream?
    dolphin, Mar 17, 2007
    1. Advertisements

  2. Read the javadocs for java.io.InputStream, java.io.Reader, and probably
    the package for java.io as well.
    Joshua Cranmer, Mar 17, 2007
    1. Advertisements

  3. dolphin wrote on 17.03.2007 14:37:
    A byte stream is for bytes (raw data) and a character stream is for character
    data. As simple as that.

    Your questions seems to indicate that you think a byte and a character is the
    same. It is not.
    Thomas Kellerer, Mar 17, 2007
  4. dolphin

    Lew Guest

    There is also Object{Input|Output}Stream which is for Objects, ...

    When you get into java.nio you have Buffer and its type-specific descendants.

    -- Lew
    Lew, Mar 17, 2007
  5. dolphin

    Mark Space Guest

    A byte stream is just that -- raw bytes.

    A character stream is for a given character set. It could be fixed
    width characters (one or two bytes) or some form of variable width like
    UTF-8. I think Java uses variable width internally, but it has readers
    for many different character streams built into the IO subsystem.
    Mark Space, Mar 17, 2007
  6. dolphin

    alireza.jn Guest

    alireza.jn, Mar 18, 2007
  7. Additional note to the OP:
    a byte is of range [-128...127], a character is of range [0...65535].
    Thomas Fritsch, Mar 18, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.