zoukankan      html  css  js  c++  java
  • java io读书笔记(4)字符数据

    Number只是java程序中需要读出和写入的一种数据类型。很多java程序需要处理有一大堆的字符组成的text,因为计算机真正懂得的只有数字,因此,字符按照某种编码规则,和数字对应。

    比如:在ASCII编码中,字符A对应着数字65.字符B对应着数字66.

    下面介绍集中编码模式:

    1)ASCII

    ASCII=American Standard Code for Information Interchange。7位字符集。

    2)Latin-1

    ISO 8859-1, Latin-1,8为字符集。

    3)Unicode

    UTF-32 is the most naïve encoding. It simply represents each character as a single 4-byte (32-bit) int.

    UTF-16 represents most characters as a 2-byte, unsigned short. However, certain less common Chinese characters, musical and mathematical symbols, and characters from dead languages such as Linear B are represented in four bytes each. The Java virtual machine uses UTF-16 internally. In fact, a Java char is not really a Unicode character. Rather it is a UTF-16 code point, and sometimes two Java chars are required to make up one Unicode character.

    Finally, UTF-8 is a relatively efficient encoding (especially when most of your text is ASCII) that uses one byte for each of the ASCII characters, two bytes for each character in many other alphabets, and three-to-four bytes for characters from Asian languages. Java's .class files use UTF-8 internally to store string literals.

    4) 其他编码

    5)Cha字符类型

  • 相关阅读:
    ES6(四)字符串的扩展
    ES6(三)数组的扩展
    ES6(二) Destructuring-变量的解构赋值
    ES6(一) let and const
    canvas(七) 文字编写
    canvas(五)createPattern
    canvas(四) Gradient- demo
    canvas(三) star- demo
    jQuery之简单动画效果
    web开发小白之路
  • 原文地址:https://www.cnblogs.com/aomi/p/3172515.html
Copyright © 2011-2022 走看看