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字符类型
java io读书笔记(4)字符数据的更多相关文章
- java io读书笔记(8)FileInputStream/FileOutputStream的应用
转自:http://www.cnblogs.com/jjtech/archive/2011/04/17/2019210.html 这是一对继承于InputStream和OutputStream的类,用 ...
- java io读书笔记(6) Writing Arrays of Bytes
显而易见,一次性写出一堆数据,要比一个byte一个byte的写,快多了,因此,outputstream,给出了2个增强型的write: public void write(byte[] data) t ...
- java io读书笔记(5) Writing Bytes to Output Streams
outputstream类是所有的字符输出类的父类,他是一个抽象类. 对于OutputStream类来说,其最基础的方法就是:write(). public abstract void write(i ...
- java io读书笔记(2)什么是stream
什么是stream?stream就是一个长度不确定的有序字节序列. Input streams move bytes of data into a Java program from some gen ...
- java io读书笔记(3)数值类型的数据
input stream读取字节:out stream写入字节.Readers读取字符而Writers写入字符.因此,如果我们想理解input和output,我们首先就要明白 java如何处理字节,整 ...
- java io读书笔记(1)综述
学习,是要持之以恒的,再读一本书,坚持. Java™ I/O, 2nd Edition By Elliotte Rusty Harold ............................... ...
- java io读书笔记(7) Closing Output Streams
输出完毕后,需要close这个stream,从而使操作系统释放相关的资源.举例: public void close( ) throws IOException 并不是所有的stream都需要clos ...
- 深入理解Java虚拟机 -- 读书笔记(1):JVM运行时数据区域
深入理解Java虚拟机 -- 读书笔记:JVM运行时数据区域 本文转载:http://blog.csdn.net/jubincn/article/details/8607790 本系列为<深入理 ...
- Java IO学习笔记:概念与原理
Java IO学习笔记:概念与原理 一.概念 Java中对文件的操作是以流的方式进行的.流是Java内存中的一组有序数据序列.Java将数据从源(文件.内存.键盘.网络)读入到内存 中,形成了 ...
随机推荐
- WordPress博客教程:博客赚钱
稍有关注独立博客的人都应该知道,中文博客实现盈利非常艰难,至少对于大部分中文博客来说是这样的.但很多时候我们不得不往赚钱的方向前进,至少要交得起域名和空间的租用费吧.不过期待赚钱前,你必须思考下如何提 ...
- jquery动态加载问题
对于append的元素,原有的方法不生效 解决:用on方法 找到的:http://www.zhidao91.com/jquery-html-live-on/ 解决使用jQuery采用append添加的 ...
- Introduction to Structured Data
https://developers.google.com/search/docs/guides/intro-structured-data Structured data refers to kin ...
- BAE3.0上的java+tomcat+hibernate代码发布
在BAE上使用hibernate说起来也简单,但因为一个不小心,耽误了好几个小时. 百度文档中有说: http://developer.baidu.com/wiki/index.php?title=d ...
- ServletContextDemo
1.servlet 之间共享数据 package xw.servlet; import javax.servlet.ServletContext; import javax.servlet.http. ...
- FW:使用weave管理docker网络
Posted on 2014-11-12 22:20 feisky 阅读(1761) 评论(0) 编辑 收藏 weave简介 Weave creates a virtual network that ...
- ThreadPoolExecutor 分析
一.从用法入手 Creates a thread pool that creates new threads as needed, but will reuse previously construc ...
- C#判断文件是复制还是剪切
private void button1_Click(object sender, EventArgs e){IDataObject vDataObject = Clipboard.GetDataOb ...
- SQL backup&restore
--完整备份Backup Database NorthwindCSTo disk='G:\Backup\NorthwindCS_Full_20070908.bak' --差异备份Backup Data ...
- IOS 手势事件的冲突
关于手操作需要强调几点: UIImageView默认是不支持交互的,也就是userInteractionEnabled=NO ,因此要接收触摸事件(手势识别),必须设置userInteractionE ...