Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1084747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:36:07+00:00 2026-05-16T22:36:07+00:00

Why does a byte in Java I/O can represent a character? And I see

  • 0

Why does a byte in Java I/O can represent a character?

And I see the characters are only ASCII. Then it’s not dynamic, right?

Is there any explanation for this?

What is the difference between byte streams and character streams?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:36:07+00:00Added an answer on May 16, 2026 at 10:36 pm

    Bytes are not characters. Alone, they can’t even represent characters.

    Computingwise, a “character” is a pairing of a numeric code (or sequence of codes) with an encoding or character set that defines how the codes map to real-world characters (or to whitespace, or to control codes).

    Only once paired with an encoding can bytes represent characters. With some encodings (like ASCII or ISO-8859-1), one byte can represent one character…and many encodings are even ASCII-compatible (meaning that the character codes from 0 to 127 align with ASCII’s definition for them)…but without the original mapping, you don’t know what you have.

    Without an encoding, bytes are just 8-bit integers.

    You can interpret them any way you like by forcing an encoding onto them. That is exactly what you’re doing when you convert a byte to char, say new String(myBytes), etc, or even edit a file containing the bytes in a text editor. (In that case, it’s the editor applying the encoding.) In doing so, you might even get something that makes sense. But without knowing the original encoding, you can’t know for sure what those bytes were intended to represent.

    It might not even be text.

    For example, consider the byte sequence 0x48 0x65 0x6c 0x6c 0x6f 0x2e. It can be interpreted as:

    • Hello. in ASCII and compatible 8-bit encodings;
    • dinner in some 8-bit encoding i made up just to prove this point;
    • 䡥汬漮 in big-endian UTF-16*;
    • a steel-blue pixel followed by a greyish-yellowish one, in RGB;
    • load r101, [0x6c6c6f2e] in some unknown processor’s assembly language;

    or any of a million other things. Those six bytes alone can’t tell you which interpretation is correct.

    With text, at least, that’s what encodings are for.

    But if you want the interpretation to be right, you need to use the same encoding to decode those bytes as was used to generate them. That’s why it’s so important to know how your text was encoded.


    The difference between a byte stream and a character stream is that the character stream attempts to work with characters rather than bytes. (It actually works with UTF-16 code units. But since we know the encoding, that’s good enough for most purposes.) If it’s wrapped around a byte stream, the character stream uses an encoding to convert the bytes read from the underlying byte stream to chars (or chars written to the stream to bytes).

    * Note: I don’t know whether “䡥汬漮” is profanity or even makes any sense…but neither does a computer unless you program it to read Chinese.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want the messagebox to only show if the number is equal to 0.
I am trying to understand the practical difference during the execution of a program
I'm trying to write test harness for part of my Android mapping application. I
I am attempting to pull some information from my tnsnames file using regex. I
Let say I have the following desire, to simplify the IConvertible's to allow me
After having read Ian Boyd 's constructor series questions ( 1 , 2 ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.