由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - [合集] java怎么这么怪呀?
相关主题
Java questionreference to objects in Vector or Map
[合集] C++ question -- how to save objectshow do I reseat a reference?
Does C++ have serializer and deserialzierwhich style do you prefer?
Boost.Serialization no longer maintained?处理海量csv数据+socket data stream processing: scala还是clojure
[合集] 问个trick的Windows编程问题std::vector里面的object存在哪里?
ajax 页面为啥收不到response 呢?【C++】请问这样有没有memory leak?多谢
boost serialization的问题这次python糗大了
serialization 到底该怎么理解啊?C++要是有null object就好了
相关话题的讨论汇总
话题: object话题: 对象话题: vector话题: java话题: stream
进入Programming版参与讨论
1 (共1页)
I*******e
发帖数: 1879
1
☆─────────────────────────────────────☆
yanb (大象 内旋内扣内韧 ) 于 (Thu Apr 9 19:49:22 2009) 提到:
假设有个Vector对象,不停地改变长短,每改变一次就作为serialized object往
socket里面发送,但得不到预期结果。
发现必须每次都new一个新对象来拷贝这个Vector对象的内容,然后发送这个新对象。
这样Vector对象改变一万次,作为程序员就得new一万个新对象来发送,还有天理么?
java这种只用reference的方式让c++程序员很难受吧?
☆─────────────────────────────────────☆
shuiguan (guanshui) 于 (Thu Apr 9 20:35:25 2009) 提到:
c++有serialization嘛?
试一下 ObjectOutputStream.reset()

☆─────────────────────────────────────☆
goodbug (好虫) 于 (Fri Ap
f**y
发帖数: 138
2
I believe when you write the same object to the socket with a loop,
the update on the object won't be reflected in the stream by default.
You'd better call enableReplaceObject(true) on the output stream
before sending the vectors. With every writeObject() call, the output
stream checks if the object referenced is already in the stream. If
so, it won't copy the object. Instead, it will just share the
same object you write to it at the first time.
After enableReplaceObject(true) has been called, t

【在 I*******e 的大作中提到】
: ☆─────────────────────────────────────☆
: yanb (大象 内旋内扣内韧 ) 于 (Thu Apr 9 19:49:22 2009) 提到:
: 假设有个Vector对象,不停地改变长短,每改变一次就作为serialized object往
: socket里面发送,但得不到预期结果。
: 发现必须每次都new一个新对象来拷贝这个Vector对象的内容,然后发送这个新对象。
: 这样Vector对象改变一万次,作为程序员就得new一万个新对象来发送,还有天理么?
: java这种只用reference的方式让c++程序员很难受吧?
: ☆─────────────────────────────────────☆
: shuiguan (guanshui) 于 (Thu Apr 9 20:35:25 2009) 提到:
: c++有serialization嘛?

1 (共1页)
进入Programming版参与讨论
相关主题
C++要是有null object就好了[合集] 问个trick的Windows编程问题
求教:c++中如何从raw data中创建对象?ajax 页面为啥收不到response 呢?
这道题贴过没有?boost serialization的问题
reinterpret cast的问题serialization 到底该怎么理解啊?
Java questionreference to objects in Vector or Map
[合集] C++ question -- how to save objectshow do I reseat a reference?
Does C++ have serializer and deserialzierwhich style do you prefer?
Boost.Serialization no longer maintained?处理海量csv数据+socket data stream processing: scala还是clojure
相关话题的讨论汇总
话题: object话题: 对象话题: vector话题: java话题: stream