How to represent general binary data

原创 2007年10月09日 12:38:00

下面的内容摘自Symbian S60 3rd Edition SDK,先把英文原版贴在这里,等时间充足的时候我再把它翻译出来。How to represent general binary data《如何表示普通的二进制数据》

How to represent general binary data

The kind of data represented or contained by descriptors is not restricted to text. Descriptors can also handle general binary data.

To deal with general binary data, always explicitly construct an 8 bit variant descriptor. Binary data should always be treated as 8 bit data regardless of the build.

For example, starting with an area in memory initialised with binary data as follows:

TUint8 data[6] = {0x00,0x01,0x02,0xAD,0xAE,0xAF};

construct a modifiable buffer descriptor using the default constructor as follows:

TBuf8<32> buffer;

The following code fragment puts the binary data into the descriptor and appends a number of single byte values. The length of the buffer is 9, the maximum length is 32 and the size is 9 regardless of the build.

TInt index;
TInt counter;

Text and general binary data can be freely mixed and the following code is acceptable:


Note that fixed length C++ arrays such as data above can be packaged inside a thin wrapper class, a TFixedArray<class T,TInt S> type, to guarantee that all array accesses are safe.


[LeetCode]401. Binary Watch

EasyA binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bot...
  • starrrr2
  • starrrr2
  • 2016年09月28日 21:58
  • 115

How programer to represent love

How programer to represent love
  • happy_cheng
  • happy_cheng
  • 2015年03月04日 23:51
  • 513

Using Binary Data datetype for storing byte arrays in mongoDB

Store GUIDs as BinData, rather than as strings BSON includes a binary data datatype for storing...
  • chenshangan
  • chenshangan
  • 2011年09月19日 10:54
  • 1662

An Architecture for Fast and General Data Processing on Large Clusters

来源: 介绍大型集群上的快速和通用数据处理架构An Architecture for Fa...
  • ASIA_kobe
  • ASIA_kobe
  • 2015年10月29日 09:42
  • 609

JAVA: String or binary data would be truncated 异常解决办法

提示:String   or   binary   data   would   be   truncated.   步骤:在执行插入语句时,会提示上面的error。 原因:是因为数据库中定义的字...
  • qq592304796
  • qq592304796
  • 2016年10月12日 09:37
  • 727

String or binary data would be truncated.解决方法

提示:String   or   binary   data   would   be   truncated.  步骤:在执行插入语句时,会提示上面的error。原因:是因为数据库中定义的字段长度比...
  • spring21st
  • spring21st
  • 2009年05月26日 14:20
  • 45228

PHP Warning: ftp_get(): Opening BINARY mode data connection for

  • mengxiangbaidu
  • mengxiangbaidu
  • 2011年11月09日 17:01
  • 2413

1018. Binary Apple Tree

1018. Binary Apple Tree Time limit: 1.0 second Memory limit: 64 MB Let's imagine how appl...
  • u012866104
  • u012866104
  • 2014年10月16日 17:31
  • 512

String or binary data would be truncated[解决方案]

异常描述: String or binary data would be truncated
  • z1119815468
  • z1119815468
  • 2013年11月22日 12:01
  • 1421

Error: String or binary data would be truncated 数据库提示错误

前段时间做什么来着,遇到这个问题,查到了解决方案,现在传上来。 解决方案就是把数据库字段的大小改大点。 比如nvarchar(10) 改成nvarchar(50)。alter table 表名 a...
  • C_ioser
  • C_ioser
  • 2018年01月05日 14:27
  • 169
您举报文章:How to represent general binary data