Topic: 请教如何接着上次的对象序列化文件继续写对象进去 |
Print this page |
1.请教如何接着上次的对象序列化文件继续写对象进去 | Copy to clipboard |
Posted by: woodworm Posted on: 2003-06-19 21:25 就是一个ObjectOutputStream写的文件。如果在close()后。甚至使其等于null后,重新new出来该OOS,writeObject(s)能把对象接着文件尾部写下去吗?如果这个不行,有什么其他的好办法? thx |
2.Re:请教如何接着上次的对象序列化文件继续写对象进去 [Re: woodworm] | Copy to clipboard |
Posted by: snowbug Posted on: 2003-06-25 01:19 Write the objects to a ByteArrayOutputStream, then use RandomAccessFile to append the bytes to the end of the stream. - but it won't be easy to read it back. A better way is to create a wrapper class that contains all the objects you want to serialize and then serialize the wrapper class object. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |