Byte and byte[] arrays

Source: Internet
Author: User
Tags string format

Byte and byte[] Array, "represents a 8-bit unsigned integer, typically a 8-bit binary number."

Byte is the most basic storage unit and the most basic communication unit of a computer.

Why is it that byte is the most basic type?

In fact, the key is that the computer's most basic algorithm is coding, including media files, pictures, and various documents so that the computer has data of the file presentation are strings, and these strings are encoded.

Whether you are a variety of strange string format, and ultimately based on the encoding table, the character converted to the corresponding decimal number, and the corresponding decimal number that, it will be stored in the byte[] array (where the decimal number is used to calculate, the storage is automatically converted to binary digital storage, The program is calculated in decimal).

Media files, pictures, various documents and so on-"the source file consists of a string, multiple characters-" single character-"decimal number (according to the corresponding code)-" byte[] Array (single character)-"byte[" Array (multiple characters)-"media files, pictures, various documents and so on storage units or communication units."

At this point the "single character" binary length is based on the corresponding code, composed of multiple characters of the byte[] is composed of media files, pictures, various documents and other source files.

Specific as follows:

UTF-8 encoding : An English character equals one byte, and a Chinese (with traditional) equals three bytes.

Unicode encoding : one English equals two bytes, and one Chinese (with traditional) equals two bytes.

Below you can see the UTF-8 encoded byte[] array (C # byte[] default storage calculated as Decimal ), so the final computer data is based on a byte type that is composed of data.

Note: In the transmission process, the basic byte[] type can also do various encoding transmission, such as Base64 string, XML, JSON, HTML, and so on, but the million change is encoded and decoded.

Byte and byte[] arrays

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.