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

  • 相关阅读:
    Android 使用 DownloadManager 管理系统下载任务的方法
    移动互联网时代:你的厕所文学是什么?
    zoj 3777 Problem Arrangement(壮压+背包)
    25个增强iOS应用程序性能的提示和技巧(0基础篇)
    Oracle 同义词
    Oracle loop、while、for循环
    Oracle 序列
    Oracle 视图
    Oracle 集合操作
    Oracle 伪列
  • 原文地址:https://www.cnblogs.com/aomi/p/3172515.html
Copyright © 2011-2022 走看看