{"rsdb":{"rid":"155997","subhead":"","postdate":"0","aid":"117105","fid":"54","uid":"1","topic":"1","content":"

1\u3001\u4ec0\u4e48\u662f\u5e8f\u5217\u5316\uff1f\u4e3a\u4ec0\u4e48\u8981\u5e8f\u5217\u5316\uff1f<\/strong><\/span><\/p>

\u3000\u3000\u3000\u3000Java \u5e8f\u5217\u5316<\/strong><\/span>\u5c31\u662f\u6307\u5c06\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u8282\u5e8f\u5217\u7684\u8fc7\u7a0b\uff0c\u800c\u53cd\u5e8f\u5217\u5316<\/strong><\/span>\u5219\u662f\u53ea\u5c06\u5b57\u8282\u5e8f\u5217\u8f6c\u6362\u6210\u76ee\u6807\u5bf9\u8c61\u7684\u8fc7\u7a0b\u3002<\/p>

\u3000\u3000\u3000\u3000\u6211\u4eec\u90fd\u77e5\u9053\uff0c\u5728\u8fdb\u884c\u6d4f\u89c8\u5668\u8bbf\u95ee\u7684\u65f6\u5019\uff0c\u6211\u4eec\u770b\u5230\u7684\u6587\u672c\u3001\u56fe\u7247\u3001\u97f3\u9891\u3001\u89c6\u9891\u7b49\u90fd\u662f\u901a\u8fc7\u4e8c\u8fdb\u5236\u5e8f\u5217\u8fdb\u884c\u4f20\u8f93\u7684\uff0c\u90a3\u4e48\u5982\u679c\u6211\u4eec\u9700\u8981\u5c06Java\u5bf9\u8c61\u8fdb\u884c\u4f20\u8f93\u7684\u65f6\u5019\uff0c\u662f\u4e0d\u662f\u4e5f\u5e94\u8be5\u5148\u5c06\u5bf9\u8c61\u8fdb\u884c\u5e8f\u5217\u5316\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\uff0c\u6211\u4eec\u9700\u8981\u5148\u5c06Java\u5bf9\u8c61\u8fdb\u884c\u5e8f\u5217\u5316\uff0c\u7136\u540e\u901a\u8fc7\u7f51\u7edc\uff0cIO\u8fdb\u884c\u4f20\u8f93\uff0c\u5f53\u5230\u8fbe\u76ee\u7684\u5730\u4e4b\u540e\uff0c\u518d\u8fdb\u884c\u53cd\u5e8f\u5217\u5316\u83b7\u53d6\u5230\u6211\u4eec\u60f3\u8981\u7684\u5bf9\u8c61\uff0c\u6700\u540e\u5b8c\u6210\u901a\u4fe1\u3002<\/p>

2\u3001\u5982\u4f55\u5b9e\u73b0\u5e8f\u5217\u5316<\/strong><\/span><\/p>

\u3000\u30002.1\u3001\u4f7f\u7528\u5230JDK\u4e2d\u5173\u952e\u7c7b ObjectOutputStream \u548cObjectInputStream<\/span><\/strong><\/span><\/p>

\u3000\u3000\u3000\u3000<\/span><\/strong>ObjectOutputStream \u7c7b\u4e2d\uff1a\u901a\u8fc7\u4f7f\u7528writeObject(Object object) \u65b9\u6cd5\uff0c\u5c06\u5bf9\u8c61\u4ee5\u4e8c\u8fdb\u5236\u683c\u5f0f\u8fdb\u884c\u5199\u5165\u3002<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000ObjectInputStream \u7c7b\u4e2d\uff1a\u901a\u8fc7\u4f7f\u7528readObject\uff08\uff09\u65b9\u6cd5\uff0c\u4ece\u8f93\u5165\u6d41\u4e2d\u8bfb\u53d6\u4e8c\u8fdb\u5236\u6d41\uff0c\u8f6c\u6362\u6210\u5bf9\u8c61\u3002<\/span><\/span><\/p>

\u3000\u30002.2\u3001\u76ee\u6807<\/strong><\/span>\u5bf9\u8c61\u9700\u8981\u5148\u5b9e\u73b0 <\/span>Seriable\u63a5\u53e3<\/span><\/strong><\/p>

\u6211\u4eec\u521b\u5efa\u4e00\u4e2aStudent\u7c7b\uff1a<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000<\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u4ee3\u7801\u4e2dStudent\u7c7b\u5b9e\u73b0\u4e86Serializable \u63a5\u53e3\uff0c\u5e76\u4e14\u751f\u6210\u4e86\u4e00\u4e2a\u7248\u672c\u53f7\uff1a<\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u9996\u5148\uff1a<\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u30001\u3001Serializable \u63a5\u53e3<\/strong>\u7684\u4f5c\u7528\u53ea\u662f\u7528\u6765\u6807\u8bc6\u6211\u4eec\u8fd9\u4e2a\u7c7b\u662f\u9700\u8981\u8fdb\u884c\u5e8f\u5217\u5316\uff0c\u5e76\u4e14Serializable \u63a5\u53e3\u4e2d\u5e76\u6ca1\u6709\u63d0\u4f9b\u4efb\u4f55\u65b9\u6cd5\u3002<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u30002\u3001serialVersionUid<\/strong>\u5e8f\u5217\u5316\u7248\u672c\u53f7\u7684\u4f5c\u7528\u662f\u7528\u6765\u533a\u5206\u6211\u4eec\u6240\u7f16\u5199\u7684\u7c7b\u7684\u7248\u672c\uff0c\u7528\u4e8e\u5224\u65ad\u53cd\u5e8f\u5217\u5316\u65f6\u7c7b\u7684\u7248\u672c\u662f\u5426\u4e00\u76f4\uff0c\u5982\u679c\u4e0d\u4e00\u81f4\u4f1a\u51fa\u73b0\u7248\u672c\u4e0d\u4e00\u81f4\u5f02\u5e38\u3002
<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u30003\u3001transient \u5173\u952e\u5b57<\/strong>\uff0c\u4e3b\u8981\u7528\u6765\u5ffd\u7565\u6211\u4eec\u4e0d\u5e0c\u671b\u8fdb\u884c\u5e8f\u5217\u5316\u7684\u53d8\u91cf<\/span><\/span><\/p>

<\/p>

\u3000\u3000\u3000\u30002.3\u3001\u5c06\u5bf9\u8c61\u8fdb\u884c\u5e8f\u5217\u6216\u548c\u53cd\u5e8f\u5217\u5316<\/strong><\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u30002.3.1 \u7b2c\u4e00\u79cd\u5199\u5165\u65b9\u5f0f\uff1a<\/strong><\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u521b\u5efa\u5bf9\u8c61Student \uff0c\u7136\u540e\u901a\u8fc7ObjectOutputStream\u7c7b\u4e2d\u7684writeObject()\u65b9\u6cd5\uff0c\u5c06\u5bf9\u8c61\u8f93\u51fa\u5230\u6587\u4ef6\u4e2d\u3002<\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u7136\u540e\u901a\u8fc7ObjectinputStream \u7c7b\u4e2d\u7684readObject\uff08\uff09\u65b9\u6cd5\u53cd\u5e8f\u5217\u5316\uff0c\u83b7\u53d6\u5bf9\u8c61\u3002<\/p>

<\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u30002.3.2 \u7b2c\u4e8c\u79cd\u5199\u5165\u65b9\u5f0f\uff1a<\/strong><\/p>

\u5728Student \u7c7b\u4e2d\u5b9e\u73b0writeObject\uff08\uff09\u548creadObject\uff08\uff09\u65b9\u6cd5\uff1a<\/strong><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u901a\u8fc7\u8fd9\u4e2d\u65b9\u5f0f\u8fdb\u884c\u5e8f\u5217\u8bdd\uff0c\u6211\u4eec\u53ef\u4ee5\u81ea\u5b9a\u4e49\u60f3\u8981\u8fdb\u884c\u5e8f\u5217\u5316\u7684\u53d8\u91cf\uff0c\u5c06\u8f93\u5165\u6d41\u548c\u8f93\u51fa\u6d41\u4f20\u5165\u5bf9\u7ebf\u5b9e\u4f8b\u4e2d\uff0c\u7136\u540e\u8fdb\u884c\u5e8f\u5217\u5316\u4ee5\u53ca\u53cd\u5e8f\u5217\u5316\u3002<\/p>

\u3000\u3000<\/p>

\u3000\u3000\u3000\u3000\u3000\u30002.3.3 \u7b2c\u4e09\u79cd\u5199\u5165\u65b9\u5f0f\uff1a<\/strong><\/p>

Student \u5b9e\u73b0Externalnalizable\u63a5\u53e3 \u800c\u4e0d\u5b9e\u73b0Serializable \u63a5\u53e3<\/strong><\/strong><\/p>

\u3000Externaliable \u63a5\u53e3\u662f Serializable \u7684\u5b50\u7c7b\uff0c\u6709\u7740\u548cSerializable\u63a5\u53e3\u540c\u6837\u7684\u529f\u80fd\uff1a<\/strong><\/strong><\/p>

<\/p>

\u3000\u3000\u3000<\/strong><\/strong>\u901a\u8fc7\u548c\u524d\u9762\u7684\u7b2c\u4e8c\u79cd\u5199\u5165\u65b9\u6cd5\u5bf9\u6bd4\uff0c\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\u4ed6\u4eec\u7684\u5b9e\u73b0\u539f\u7406\u90fd\u662f\u5341\u5206\u7684\u7c7b\u4f3c\uff0c\u4e0d\u8fc7\u5b9e\u73b0Externalnalizable\u63a5\u53e3 <\/strong>\u5e76\u4e0d\u652f\u6301\u7b2c\u4e00\u79cd\u5e8f\u5217\u5316\u65b9\u6cd5\uff0c\u5b83\u53ea\u80fd\u591f\u901a\u8fc7\u5b9e\u73b0\u63a5\u53e3\u4e2d\u7684writeExternal()\u548creadExternal\uff08\uff09\u65b9\u6cd5\u5b9e\u73b0\u5bf9\u8c61\u7684\u5e8f\u5217\u5316\u3002<\/p>

<\/p>

<\/p>

3\u3001\u9762\u8bd5\u4e2d\u5173\u4e8e\u5e8f\u5217\u5316\u7684\u95ee\u9898\uff1a<\/strong><\/span><\/p>

\u3000\u3000\u3000\u3000<\/span>1\u3001\u4ec0\u4e48\u662f\u5e8f\u5217\u5316\uff0c\u5982\u4f55\u5b9e\u73b0\u5e8f\u5217\u5316<\/span><\/strong><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000java\u4e2d\u5bf9\u8c61\u7684\u5e8f\u5217\u5316\u5c31\u662f\u5c06\u5bf9\u8c61\u8f6c\u6362\u6210\u4e8c\u8fdb\u5236\u5e8f\u5217\uff0c\u53cd\u5e8f\u5217\u5316\u5219\u662f\u5c06\u4e8c\u8fdb\u5236\u5e8f\u5217\u8f6c\u6362\u6210\u5bf9\u8c61<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000Java \u5b9e\u73b0\u5e8f\u5217\u5316\u6709\u591a\u79cd\u65b9\u5f0f<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30001\u3001\u9996\u5148\u9700\u8981\u4f7f\u7528\u5230\u5de5\u5177\u7c7bObjectInputStream \u548cObjectOutputStream \u4e24\u4e2aIO\u7c7b<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30002\u3001\u5b9e\u73b0Serializable \u63a5\u53e3\uff1a<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u6709\u4e24\u79cd\u5177\u4f53\u5e8f\u5217\u5316\u65b9\u6cd5\uff1a<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30002.1 \u76f4\u63a5\u901a\u8fc7ObjectOutputStream \u548c ObjectInputStream \u7c7b\u4e2d\u7684 writeObject\uff08\uff09\u548creadObject\uff08\uff09\u65b9\u6cd5<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30002.2 \u901a\u8fc7\u5728\u5e8f\u5217\u5316\u5bf9\u8c61\u4e2d\u5b9e\u73b0writeObject\uff08\uff09\u548creadObject\uff08\uff09\u65b9\u6cd5\uff0c\u4f20\u5165ObjectOutputStream\u548cObjectInputStream\u5bf9\u8c61\uff0c\u5b8c\u6210\u5e8f\u5217\u5316<\/span><\/span><\/p>

\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30003\u3001\u5b9e\u73b0Externalizable \u63a5\u53e3\uff1a<\/span><\/span><\/p>","orderid":"0","title":"Java \u5e8f\u5217\u5316\u4e0e\u53cd\u5e8f\u5217\u5316","smalltitle":"","mid":"0","fname":"linux\u7f16\u7a0b\u57fa\u7840","special_id":"0","bak_id":"0","info":"0","hits":"140","pages":"1","comments":"0","posttime":"2017-01-02 08:15:17","list":"1483316117","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"http:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"Java<\/A> \u5e8f\u5217\u5316<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.17.22.31","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"Java \u5e8f\u5217\u5316\u4e0e\u53cd\u5e8f\u5217\u5316","lastview":"1500763206","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}