`

know how many bytes does your ICE object occupy..

阅读更多

occasionally, we need to konw the exact size of each Ice object. so we have to do serialization manually.

 

first...compile .ice file with --stream.

 

ICE will generate a helper function for every entity class.

 

for checking size, write it to outputstream first:

 

Ice.Communicator comm = Ice.Util.initialize();
Ice.OutputStream os = Ice.Util.createOutputStream(comm);

Txx xx = new Txx() //this Txx type is derived from Ice.Object

 

TxxHelper.write(os, xx);

os.writePendingObjects(); //make sure all bytes run into stream buffer.

 

byte[] data = os.finished();

os.destroy();

 

now check the size of data and you will know how many bytes your object does consume.

 

for reading an object from inputstream. do it in opposite way:

 

Ice.InputStream ins = Ice.Util.createInputStream(comm, data);

TxxHelper helper = new TxxHelper(ins);

helper.read();

ins.readPendingObjects();

 

if no exception, you may play the object with helper.value .

 

According to the manual, --stream is available for c++/java/c# only.

分享到:
评论

相关推荐

    LuaUnicode icu-lua

    If you want to know how many printing columns a Unicode string will occupy when you print it out using a fixed-width font (imagine you are writing something like the Unix ls program that formats its ...

    iOS Auto Layout Demystified

    ful system that describes how views and their content relate to each other and to the superviews they occupy. In contrast to older design approaches, this technology offers incredible control over ...

    中关村在线

    LARGE_OBJECT_SIZE_COUNTER_009_HELP=This counter displays the current size of the Large Object Heap in bytes. Objects greater than 20 KBytes are treated as large objects by the Garbage Collector and ...

    Waller Easy

    Have you a tools software for manage a lot of your own wallpapers? Waller Easy is it. It provides you 2 ways to active wallpaper. One was called system start mode, with this mode application will be...

    Mask 98 for PRwin98

    files occupy about 0.5Mb of hard disk space. A display resolution of 640x480 (standard VGA) or better is recommended. Mask for Windows - PRWin98 will run on any 80286, 80386, 80486 (SX, DX, DX2), or ...

    poj1001高精度乘法

    If you don't know how to determine wheather encounted the end of input: s is a string and n is an integer C++ while(cin>>s>>n) { ... } c while(scanf("%s%d",s,&n)==2) //to see if the scanf read...

    怪异字符串转换

    An int type variable always occupy 4 bytes consecutively, so is an array of 4 char type elements. Write a function to convert an unsigned int type variable into an array of 4 char type elements.

    2014届高考英语完形填空常考词汇(三).doc

    - exist: 存在,如:Does life exist on other planets? - appear: 出现,如:Suddenly, a rabbit appeared in front of us. - survive: 幸存,如:She survived the earthquake but lost her family. - live: ...

    英语写作必备的句子

    13. "A proper part-time job does not occupy students' too much time. In fact, it is unhealthy for them always to sit in the classroom studying all the time." 这句话支持适度兼职工作对学生的好处,可以...

    传说中的商志作文模板

    2. **合理安排工作与休息**:“A proper part-time job does not occupy students too much time. In fact, it is unhealthy for them to spend all time on their study. As an old saying goes: All work and no ...

    考研英语180必背作文句

    > A proper part-time job does not occupy students too much time. In fact, it is unhealthy for them to spend all the time on their study. As an old saying goes: All work and no play makes Jack a dull ...

    WPF 国际象棋 棋子 ChessProgrammingTest.zip

    Use Object Oriented Design and Modeling appropriately for extensibility. Please supply all the code for your solution in the file Answer.cs in the SampleProgram project. Please supply all the tests ...

    英语写作必背200句

    - "A proper part-time job does not occupy students' too much time. In fact, it is unhealthy for them to spend all time on their study. As an old saying goes: All work and no play makes Jack a dull ...

    吴建业作文观点汇总

    10. The experiences you have and the people you meet will provide you with many lifelong memories that you’ll cherish forever. Tele-Education 远程教育 1. (优点): Improve the flexibility of learning ...

    考研英语大作文必背的184个句式(精编突出重点版)

    - 句式:A proper part-time job does not occupy students too much time. In fact, it is unhealthy for them to spend all time on their study. As an old saying goes: All work and no play makes Jack a ...

    Big.Data.and.IT.Professionals.1514870622

    The study also examined if there was any relationship between an IT professional's understanding of big data and the position they occupy professionally. Table of Contents Acknowledgments ...

    典型句型200句.pdf典型句型200句.pdf

    ### 句型12: A proper part-time job does not occupy students' too much time. In fact, it is unhealthy for them to spend all their time on their study. 最后,这个句型通过“in fact”转折,指出兼职工作...

    UnitWheels时PPT教案学习.pptx

    例如,"occupy sb. /oneself with sth. /(in) doing sth." 表示“使某人忙于某事”,而 "sb. be occupied with sth. /(in) doing sth." 则表示“某人正忙于某事”。同时,课程还扩展介绍了其他表达“忙于做某事”的...

    Introducing Data Science(Manning,2016)

    Introducing Data Science teaches you how to accomplish the fundamental tasks that occupy data scientists. Using the Python language and common Python libraries, you’ll experience firsthand the ...

    黄书皮风景名胜B2_U9TA.pdf

    还可以表示“忙于做某事”,如:他退休后如何打发时间呢(How does he occupy himself now he's retired?)。 - **integrate**:意为“构成整体”,例如:这些建筑与周围景观完美融合(The buildings are well ...

Global site tag (gtag.js) - Google Analytics