• 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字符类型

  • 相关阅读:
    委托&指针函数&回调函数
    Unity animation笔记1
    hadoop源码编译
    protocbuf的安装
    学习hadoop不错的一些文章
    moven的安装
    在Linux上安装与配置Hadoop
    linux tar命令详解
    How to contribute to hadoop common
    Ubuntu下SVN的安装
  • 原文地址:https://www.cnblogs.com/aomi/p/3172515.html
Copyright © 2020-2023  润新知