首页 > 其他 > 详细

字节序

时间:2015-03-10 18:49:44      阅读:144      评论:0      收藏:0      [点我收藏+]

$.字节序是指多字节数据在计算机内存中存储或者网络传输时各字节的存储顺序。

$.一个多字节数据按照其存储地址从低到高排列,如果最低有效字节在最高有效字节的前面,则称小端序;反之则称大端序。

$.因为字符串是一个字节一个字节编码的,所以不存在大小端问题。

$.注1
public static byte[] BitConverter.GetBytes(int value);

The order of bytes in the array returned by the GetBytes method depends on whether the computer
architecture is little-endian or big-endian.

$.注2
public static readonly bool BitConverter.IsLittleEndian;

This value is true if the architecture is little-endian; false if it is big-endian.

$.注3
public virtual int BinaryReader.ReadInt32();
public virutal int BinaryWriter.WriteInt32();

BinaryReader使用小端序读取数据;类似的,BinaryWriter也使用小端序写入数据。

$.参考
http://www.cnblogs.com/jeffreyzhao/archive/2010/02/10/byte-order-and-related-library.html

字节序

原文:http://www.cnblogs.com/codingthings/p/4326604.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!