Java基础知识:序列化和反序列化

一、序列化和反序列化的概念

  把对象转换为字节序列的过程称为对象的序列化
  把字节序列恢复为对象的过程称为对象的反序列化
  对象的序列化主要有两种用途:
  1) 把对象的字节序列永久地保存到硬盘上,通常存放在一个文件中;
  2) 在网络上传送对象的字节序列。

  在很多应用中,需要对某些对象进行序列化,让它们离开内存空间,入住物理硬盘,以便长期保存。比如最常见的是Web服务器中的Session对象,当有 10万用户并发访问,就有可能出现10万个Session对象,内存可能吃不消,于是Web容器就会把一些seesion先序列化到硬盘中,等要用了,再把保存在硬盘中的对象还原到内存中。

  当两个进程在进行远程通信时,彼此可以发送各种类型的数据。无论是何种类型的数据,都会以二进制序列的形式在网络上传送。发送方需要把这个Java对象转换为字节序列,才能在网络上传送;接收方则需要把字节序列再恢复为Java对象。

二、JDK类库中的序列化API

  java.io.ObjectOutputStream代表对象输出流,它的writeObject(Object obj)方法可对参数指定的obj对象进行序列化,把得到的字节序列写到一个目标输出流中。
  java.io.ObjectInputStream代表对象输入流,它的readObject()方法从一个源输入流中读取字节序列,再把它们反序列化为一个对象,并将其返回。
  只有实现了Serializable和Externalizable接口的类的对象才能被序列化。Externalizable接口继承自
Serializable接口,实现Externalizable接口的类完全由自身来控制序列化的行为,而仅实现Serializable接口的类可以
采用默认的序列化方式 。
  对象序列化包括如下步骤:
  1) 创建一个对象输出流,它可以包装一个其他类型的目标输出流,如文件输出流;
  2) 通过对象输出流的writeObject()方法写对象。

  对象反序列化的步骤如下:
  1) 创建一个对象输入流,它可以包装一个其他类型的源输入流,如文件输入流;
  2) 通过对象输入流的readObject()方法读取对象。

对象序列化和反序列范例:

  定义一个Person类,实现Serializable接口

import java.io.Serializable;

/**
* <p>ClassName: Person<p>
* <p>Description:测试对象序列化和反序列化<p>
* @author xudp
* @version 1.0 V
* @createTime 2014-6-9 下午02:33:25
*/
public class Person implements Serializable { /**
* 序列化ID
*/
private static final long serialVersionUID = -5809782578272943999L;
private int age;
private String name;
private String sex; public int getAge() {
return age;
} public String getName() {
return name;
} public String getSex() {
return sex;
} public void setAge(int age) {
this.age = age;
} public void setName(String name) {
this.name = name;
} public void setSex(String sex) {
this.sex = sex;
}
}

代码

  序列化和反序列化Person类对象

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.text.MessageFormat; /**
* <p>ClassName: TestObjSerializeAndDeserialize<p>
* <p>Description: 测试对象的序列化和反序列<p>
* @author xudp
* @version 1.0 V
* @createTime 2014-6-9 下午03:17:25
*/
public class TestObjSerializeAndDeserialize { public static void main(String[] args) throws Exception {
SerializePerson();//序列化Person对象
Person p = DeserializePerson();//反序列Perons对象
System.out.println(MessageFormat.format("name={0},age={1},sex={2}",
p.getName(), p.getAge(), p.getSex()));
} /**
* MethodName: SerializePerson
* Description: 序列化Person对象
* @author xudp
* @throws FileNotFoundException
* @throws IOException
*/
private static void SerializePerson() throws FileNotFoundException,
IOException {
Person person = new Person();
person.setName("gacl");
person.setAge(25);
person.setSex("男");
// ObjectOutputStream 对象输出流,将Person对象存储到E盘的Person.txt文件中,完成对Person对象的序列化操作
ObjectOutputStream oo = new ObjectOutputStream(new FileOutputStream(
new File("E:/Person.txt")));
oo.writeObject(person);
System.out.println("Person对象序列化成功!");
oo.close();
} /**
* MethodName: DeserializePerson
* Description: 反序列Perons对象
* @author xudp
* @return
* @throws Exception
* @throws IOException
*/
private static Person DeserializePerson() throws Exception, IOException {
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(
new File("E:/Person.txt")));
Person person = (Person) ois.readObject();
System.out.println("Person对象反序列化成功!");
return person;
} }

代码

代码运行结果如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQoAAABhCAIAAACh7XizAAAMPElEQVR4nO1c/2scxxXff0d3/0F+KwX9kB9CfyiRa6c4ocJJ6tTCq0Sm/aEmGCKXBiLqFttsYuFCjI0tVEMMzhHH9Zc42MQcsU9B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bmf39ennDE7djfPr2mJnq4ZwWtM+E03GMVxEuEooVVz1XarhNUp3fHcfsHsymus6WlddEzmfThhn5x2KzWBeWNo3hhSagJiuefxuPPhpOfJVHBCFZZq4rOmVEue4evrU84a3K3K+RwljVWQ84UmYXVKN5Bv8WILbtTgRF5a0tP6mFi19lTuH5WtPJGuPH7x2qNTwaeKNbEyLJ3fnDEm1ZYc7bn9c3fCTV3Xs9W1/QUP/5zPNoWuLWeM4T/Pry1nA5gxkvGIzKMKyGeSsDqlS8i3LGNmN6p3IPOW9KwxLtduStQRiToinguL58LiucikKiKdj8q1caUppbbkNPY87VO6uyZ/2uSgcr5coWh6P78DBDmfTcLqlO4hf3EZM7lQw1JeY82oF1KzxsSMKanQxxX6uMKQVBgSSlNyzpyetyEaO8Pn88/9EG7qup7dIl9iWKASfiyfi+eRlwa9QqW6e//etevXb968ubq6uhUurIGxJ3XSa2mdhNUpXUX+ggczuwvGJVTvzGvtiMaWm7dk5y3Zl5bcvBXR2BGtLa9zoIzfybM78jOZjFK98P3IyMWhoVOnT588efLs2bNDQ0PXrl0bGRnR6XTpdLo9b/y+CXI+m4TVKd1GPvXduyZXwegqGF0FvRPVO1HqizerGy0kH8fxYDD44sWL0dHRqakpnU5ns9m8Xm8oFIpGo7lcrvpBXcj5HS9hdUp3kr/Tb93eJfndbFCDREuBAvhguVKp7Jj8LY3PuZ+rXM+US2MzjlGF7fGU9ZFs8YHEfF9ivCc2JFLZNzv8QG0TkH/wXNkV+d9Lg3/8h+ZXX0z88sToL/768Od/+d/P/jTy054ff/LJD7kCmUCIW4+Vvz78WTyVacc4BL1p/R9XKKQ6UHY7MwAAAABJRU5ErkJggg==" alt="" />

序列化Person成功后在E盘生成了一个Person.txt文件,而反序列化Person是读取E盘的Person.txt后生成了一个Person对象

三、序列化、反序列化为XML文件

序列化、反序列化为XML文件,我使用了XStream来序列化,需要引入xstream-1.3.1.jar包的支持,
http://xstream.codehaus.org/download.html  处可以下载jar,然后引入到Eclipse中的build path中。
Serialize.java的代码如下:

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import com.thoughtworks.xstream.*; public class Serialize {
public static void main(String[] args) {
Serialize ser = new Serialize();
ser.serializeToXml();
ser.deSerializeFromXml();
} public void serializeToXml(){
Person[] myPerson = new Person[2];
myPerson[0] = new Person("Jay",24);
myPerson[1] = new Person("Tom",23); XStream xstream = new XStream();
try {
FileOutputStream fos = new FileOutputStream("E:\\workspace\\2010_03\\src\\myPerson.xml");
xstream.toXML(myPerson,fos);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
System.out.println(xstream.toXML(myPerson));
}
public void deSerializeFromXml(){
XStream xs = new XStream();
Person[] myPerson = null; try {
FileInputStream fis = new FileInputStream("E:\\workspace\\2010_03\\src\\myPerson.xml");
myPerson=(Person[])xs.fromXML(fis);
if (myPerson != null)
{
int len = myPerson.length;
for (int i=0;i<len;i++)
{
System.out.println(myPerson[i].getName());
System.out.println(myPerson[i].getAge());
} }
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
}
}

代码

运行结果为(console输出),当然可以查看到myPerson.xml文件已经生成:
Inside Person's Constructor
Inside Person's Constructor
<Person-array>
  <Person>
    <name>Jay</name>
    <age>24</age>
  </Person>
  <Person>
    <name>Tom</name>
    <age>23</age>
  </Person>
</Person-array>
Jay
24
Tom
23

参考资料:
http://developer.51cto.com/art/200908/147650.htm
http://www.ibm.com/developerworks/cn/xml/x-xstream/#resources
http://www.cnblogs.com/stephencat/archive/2007/06/05/772520.html

转载:http://renyongjie668.blog.163.com/blog/static/1600531201022105142865/

四、serialVersionUID的作用

  s​e​r​i​a​l​V​e​r​s​i​o​n​U​I​D​:​ ​字​面​意​思​上​是​序​列​化​的​版​本​号​,凡是实现Serializable接口的类都有一个表示序列化版本标识符的静态变量

 private static final long serialVersionUID

  实现Serializable接口的类如果类中没有添加serialVersionUID,那么就会出现如下的警告提示

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAvIAAACp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kfNCcpkg6CJBF+W80DJ42LxCTXhqYccdAPzkXWEA0PbC8kqHnOyUVzq0vfBP3hV+2x/QsxF4zthZzEbesgMO3hVW1v1mnrJe1qpVpvwA8Ceztu2vaBumzpn6galzFXVD2fI73m+fxTSKomgdrNKthk5ZpmxVHi1TNnRK3WkrMDGJRArHCzYPANoJgaZFENN1sHE7rfGBcokFgHKJ1Y4ChjgjkQiY1xKJ2P1/N+2AAcC6H/247AeA99NeKzdWYGKGgAW9HkPACkysbowO2O6KXh3hb9TM0jAASCRShW25K2x3hScvAKB7cEpKoQoTMgTsar7dEDAlG8ql0F/ME4u71CbbNzQpkYh1N66w0aDXo7BRSxyvkzc0p5izrtAId37D4b7Ph7lXIZ6Z7XkV4pCb43BfdU7OUTl26IlPcLivNp/4hOuSNPkDDaOBuXn9q/nf//lf5i81OE8ovCBEPwAAAABJRU5ErkJggg==" alt="" />就会弹出生成serialVersionUID的对话框,如下图所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAArwAAADPCAIAAACY8ZVSAAAgAElEQVR4nO19W3MUR5p2/4jvZm/mai92Lz5H2P72AsfujCM8EWuCJWJHETg89owHrw1MwH7CYztMO4wXPAMznjDMuBeagweDzdrCBmRog0wjMCOEJbUEQqBDW1iSsbCwMegwSICAblF7Ud3VWXmqrFN3VvE88YSiyM58882spN6n3jolxn8Y3P/R9u3NM9ubZ8Z/GHxweZv8rxEcxn8Y9NDo/V+dPjERoBcAAAAAACghQYoGR8XgKcwLEaw1AAAAAABCRSJqmQYAAAAAAGoDZBoAAAAAAFBCjTMNV6bvgR744PI2rVjzCQFBEASrQDrTQMX1sDMNNR9/RFlzlQDRAIIgeB/SJhoMw5j6/NnxvY+O739sfO+jU58/y+oGiAYdWHOVANEAgiB4H9ImGq6fWDr91+eM75tMzvz1uet/XUrpBogGHVhzlQDRAIIgeB/SJhomDv6k+MOBuSufWH/HD/zEjO7INGjFmqsEiAYQBMH7kDbRMJX9SWHq0+J0e3H6i+J0e2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JUC0QDAAAAAMQGeCMkAAAAAABKwBshAQAAAABQAjINAAAAAAAo4X8B6VahRUTxQnEAAAAASUVORK5CYII=" alt="" />

  serialVersionUID有两种生成方式:

  采用aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAAVCAIAAACMmjY4AAACV0lEQVRoge1av0vDQBTuv9SxotChQzN0MENpra3VYgoVkqFQKFbQQRddIoguzSBdCgq6ukkRREQd4iCCSMFZ/AviEAzhfry7nGmT4R0fx/V+vPfuvS8fbUnm53uKQMSOjIcN2wxaxn25RyBih4piZTt3TycL2GPP6z3PUyGWfx6B4EGRWInHjUgzBIq1drXtAxULERUQseqX/c8vo37RhxWLKWDMbUKpk98jqZrzl1jYV9riiZTDIHIeEwIIFKs67r1PN1fGPXoprFg86/S8zCWFhYklufMs7SyKnXjMwUeg+lxilUdd96NVHnXpJcIE0zoSK95bJItIxGIolj609KGpO5buWMtD8/Ft3R/rjqk7pu5YhGJ5f9pIeCXYxmQkHTrzFL2BtycY03tgR0AwkXwxzTIfRck88IwDGyLFw7zm/4mVpRWrdNaZuE0GXpsTt1k63WLWjFlFYADEDZ8SXk/mlLC08BFh2YQFkPcOD2T4qpYxBTthMBSraBua3S7aRtFua8ftm+eGZhv+pGa3Ndvwt4UVi35KFELnJY7JY+Ig7B1mCZxKwgjPF2xZ5hZMI2reYbbNh1hZ+DtW4ah1/bBaONyglyIFqkwshevFSCxhPGoRSnqXeaJkSJAIsQS/CvMHjfFdLb/foJd8xQpfnh7DM7xUMk8BRmBfRAMqJwyGiAewyZuE4xHyRt47nQrexWmbcCoI73ACucRa2q2d31YX92qRMoJACBQrt1PJDSq5QYVewn/eETAgYgEt8bgRaQa+3YCYFdQVK/E3frBPc69ILGzYhO0XUZDh8519YgEAAAAASUVORK5CYII=" alt="" />这种方式生成的serialVersionUID是1L,例如:

 private static final long serialVersionUID = 1L;

  采用aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAANEAAAATCAIAAACBeH8HAAACK0lEQVRoge1VMUvDQBTO3yoodOjQDB3MUFpra7WYgEI6FArFCjrooktcdGkG6VJQ0NVNxEUElwqKICI4CP6HOhQ13L17eUnaS9H3ccPdy7v3fXn35WKMouPz45EHD2Tg/jFieI7BSAL2HEM32HMM3VB6bvl8czx0qmH8Byg9Vz3rvL7b1dNOyH4DqGAYhhCXI7OPKWnGaxrfmDhvPD3ECkEIESBfVag8aD+/rS0O2vEUy/HZ8RxdSVqaZ6dXdMi3DBgfIZ4r9lvDl0ax3wplUl11oZG0wJ6bBmJ6zuo1rZ5r+U3Lby703LunlfHc8l3Ldy2/CdKAv9FgkPK/kG9jeY7/soWLHcxRiVFFEM2gpFA9YE2QXcUraMM7BgYj6VF1HlQFLoH6wUXheP16WAfGQ/16WC8cbYA0QtNDJ4jc5BPKm4fmRNKM10HS6AoR9njdiKSH0g1Knd9HwUXes03PyXt23nPMQ+fyvmZ69jhoeo7p2TKN/N3EViw0nVJZlQOKlNtB50qoWdgVVaGqSDx23Ii6PRdE7qBxcbuU21+l0CT0HHgMdK5Iu+Q04i4VIulB2CN5bgQ5nsIeypWm57J7tcFNJbtbQziEKyc4xyNgKdW1Ac7xHGJxkGsamhEioZQAkPpnl0oShShUj6om3gqBHc5XvdL8duXkqjy3U0Fee1IQjk0DIyNFKA84s1XKdEuZbkmTDsKXzfgb4DNm6AZ7jqEb7DmGbrDnGLrxBTOIm3wX0K0ZAAAAAElFTkSuQmCC" alt="" />这种方式生成的serialVersionUID是根据类名,接口名,方法和属性等来生成的,例如:

 private static final long serialVersionUID = 4603642343377807741L;

  添加了之后就不会出现那个警告提示了,如下所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj0AAABmCAIAAACvJbdLAAAQNUlEQVR4nO2dz2/bRhbHp39Az/1zmn9CZ/8Pg70Guunia7EXwgcjBwFZIIeiq2JZwDXkdLuFYmTdsFLsooqt1q1LyVZrIA7QTcs98Mf8fMOhLEsi9f3gHazh8M0bUn5fvuE4YQnN7Nf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  扯了那么多,那么serialVersionUID(序列化版本号)到底有什么用呢,我们用如下的例子来说明一下serialVersionUID的作用,看下面的代码:

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable; public class TestSerialversionUID { public static void main(String[] args) throws Exception {
SerializeCustomer();// 序列化Customer对象
Customer customer = DeserializeCustomer();// 反序列Customer对象
System.out.println(customer);
} /**
* MethodName: SerializeCustomer
* Description: 序列化Customer对象
* @author xudp
* @throws FileNotFoundException
* @throws IOException
*/
private static void SerializeCustomer() throws FileNotFoundException,
IOException {
Customer customer = new Customer("gacl",25);
// ObjectOutputStream 对象输出流
ObjectOutputStream oo = new ObjectOutputStream(new FileOutputStream(
new File("E:/Customer.txt")));
oo.writeObject(customer);
System.out.println("Customer对象序列化成功!");
oo.close();
} /**
* MethodName: DeserializeCustomer
* Description: 反序列Customer对象
* @author xudp
* @return
* @throws Exception
* @throws IOException
*/
private static Customer DeserializeCustomer() throws Exception, IOException {
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(
new File("E:/Customer.txt")));
Customer customer = (Customer) ois.readObject();
System.out.println("Customer对象反序列化成功!");
return customer;
}
} /**
* <p>ClassName: Customer<p>
* <p>Description: Customer实现了Serializable接口,可以被序列化<p>
* @author xudp
* @version 1.0 V
* @createTime 2014-6-9 下午04:20:17
*/
class Customer implements Serializable {
//Customer类中没有定义serialVersionUID
private String name;
private int age; public Customer(String name, int age) {
this.name = name;
this.age = age;
} /*
* @MethodName toString
* @Description 重写Object类的toString()方法
* @author xudp
* @return string
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "name=" + name + ", age=" + age;
}
}

代码

运行结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXkAAABkCAIAAADsXtebAAATRklEQVR4nO1d/3MTZ3rfn8k1f4exZzJ1yU0v9O4yN72hk8yUKTe9swvXwefzEQcoX+TU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AQZu7MpXv2az3lXpLYYCP5EqRVKpdcjibqwFTEJitIquBpO1H7oTDOIPb/+VbOMCZntWtwIvc28RaFz90EW4XgwFnV8yIiG9uwOfmC6bNcwPGPXWlyBnA1/yo2V1aMqdfvvW9lm+sQ8lEBsmV8FwZz5bwTB6NJYpW586ccuP5rHdaFZXpkipz9kjuG0il2iU7dJhqUOfJfs7zusBefBi0n9rbX4DAS9pXy/tNYo5xnBqM7xRhdm/F4CwsmtIzysCzOff8ok9riKxaY6vWmNYQkan8L2Y9z+b9Lxeic7qEwgBrbPkjuYsslWo1Ft/BqoGYIsAZz7mXcDXg64RPR1wNuq5BwMARwNd8qMWDrDgKi+aMTLf1ShWeVgZfKoIv3u55eiH6Sr0l0yYUq7tL1pzeUWZ9p+jqo0RHt7+9UqlWt+Y/2AVTzsbmUbjwQJ+1yokB63B8fXJmDmuv9qNztuy1c/bYRQ0IBo5N3O5DzRCy6ihorLDKuCvXJ+X6pGw5IVtOyJaT87qkYjWtMsJaW17vKBvcFdYXrQ+MwaINYqqBSq0Wg8EgCGDQzYcwbV7UslExOIv6tbzGml2y5dRmWG2G1Zac2pLV2nLL9sKqCzG4OZ43uPqfREe3v71SqVZuWWNKQaZShivIisWs1ukmnzy+c/fu/fv34/F4+159L4BBl59Ftvsw6wZq9lSMbsTgKq86SquO0oqjvOpEDG7E6KqYIJTz6bODYVAsFrX6tX9PTV0fH7946dKFCxeuXLkyPj5+586dqakpk8lUKBSO/0PvugAGPfGXKWxezOrFrF7M7EHNHpR5Er+xcIQYkCQZjUbfvn07PT29sLBgMplcLlcgEIjFYul0ulwuD+Z3rf8Pf9qjflNRAbcAAAAASUVORK5CYII=" alt="" />

序列化和反序列化都成功了。

下面我们修改一下Customer类,添加多一个sex属性,如下:

class Customer implements Serializable {
//Customer类中没有定义serialVersionUID
private String name;
private int age; //新添加的sex属性
private String sex; public Customer(String name, int age) {
this.name = name;
this.age = age;
} public Customer(String name, int age,String sex) {
this.name = name;
this.age = age;
this.sex = sex;
} /*
* @MethodName toString
* @Description 重写Object类的toString()方法
* @author xudp
* @return string
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "name=" + name + ", age=" + age;
}
}

代码

  然后执行反序列操作,此时就会抛出如下的异常信息:

 Exception in thread "main" java.io.InvalidClassException: Customer;
local class incompatible:
stream classdesc serialVersionUID = -88175599799432325,
local class serialVersionUID = -5182532647273106745

  意思就是说,文件流中的class和classpath中的class,也就是修改过后的class,不兼容了,处于安全机制考虑,程序抛出了错误,并且拒绝载入。那么如果我们真的有需求要在序列化后添加一个字段或者方法呢?应该怎么办?那就是自己去指定serialVersionUID。在TestSerialversionUID例子中,没有指定Customer类的serialVersionUID的,那么java编译器会自动给这个class进行一个摘要算法,类似于指纹算法,只要这个文件 多一个空格,得到的UID就会截然不同的,可以保证在这么多类中,这个编号是唯一的。所以,添加了一个字段后,由于没有显指定 serialVersionUID,编译器又为我们生成了一个UID,当然和前面保存在文件中的那个不会一样了,于是就出现了2个序列化版本号不一致的错误。因此,只要我们自己指定了serialVersionUID,就可以在序列化后,去添加一个字段,或者方法,而不会影响到后期的还原,还原后的对象照样可以使用,而且还多了方法或者属性可以用。

  下面继续修改Customer类,给Customer指定一个serialVersionUID,修改后的代码如下:

class Customer implements Serializable {
/**
* Customer类中定义的serialVersionUID(序列化版本号)
*/
private static final long serialVersionUID = -5182532647273106745L;
private String name;
private int age; //新添加的sex属性
//private String sex; public Customer(String name, int age) {
this.name = name;
this.age = age;
} /*public Customer(String name, int age,String sex) {
this.name = name;
this.age = age;
this.sex = sex;
}*/ /*
* @MethodName toString
* @Description 重写Object类的toString()方法
* @author xudp
* @return string
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "name=" + name + ", age=" + age;
}
}

代码

  重新执行序列化操作,将Customer对象序列化到本地硬盘的Customer.txt文件存储,然后修改Customer类,添加sex属性,修改后的Customer类代码如下:

class Customer implements Serializable {
/**
* Customer类中定义的serialVersionUID(序列化版本号)
*/
private static final long serialVersionUID = -5182532647273106745L;
private String name;
private int age; //新添加的sex属性
private String sex; public Customer(String name, int age) {
this.name = name;
this.age = age;
} public Customer(String name, int age,String sex) {
this.name = name;
this.age = age;
this.sex = sex;
} /*
* @MethodName toString
* @Description 重写Object类的toString()方法
* @author xudp
* @return string
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "name=" + name + ", age=" + age;
}
}

代码

执行反序列操作,这次就可以反序列成功了,如下所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAANAAAAAqCAIAAABNz0JcAAAEkUlEQVR4nO1bwXHsIAylZrrJ0EAOqYA6fEgL8aQH/wMBC5CEwF7iT/SGSbxYlgR6CHutNd9fn99fnx/vb+GgaMYYeFx/DD3wGF4I/9ZitYaiX2gdvQqeolqthHESFWsKUPPT7KyBBqXXVj0udFDN6KDeMrNxmuAJp03bvU0Jp21qU8Jpm9pKwn28v2nT9rpWEu5YHcaYgVNX1F5XTl0OO+X6Bzy56HymSgmX+gsItckvKQQKuqDg3b5IuJdylFS1GOGavGlGjpJBTfQ6M+aexO0x9vCklyiXzEMmvxjhCkgi2kUIVIPceu8lTDZiFkl9qov3jC1q9iRD+5Ffj3D11FNT3FzKXYSj4tRF5eLsAOG6qMkPRMjOGwi3uajb+t1bt8kVPgIp0tSpoocBqkEoj35kwsPwrBlm+ZDlhGMcYzxpKK8JtzljIsV2b835qRu/xdVi9uGMSOLNC1OhHetBT/GEQx1gAl+sh+ZszCUckdAg80L+s35PZ72NA7LWWn9eAAC1gnNApbU/irdwPlo4860xQTlQYv0eTWV+U8uaicohoyYVb1SyCVRn1wHvbZcSqvOVhNscZBJERkUgtnubjjdXcAIhr7eArJuL8jGxBhV7Urs5wKTdW6g/cT8cQ2NCwsHA139RoKp6I8foaco0r2o6zI+RoXIXt3Dl1wmXp6CMYQjhqgwaNW0upUa3HYnHUHdtgvCWSVfNWS5yDyOJGqIkhW7I3U6mB1ZI0+06+zbdFgLbUmEKAaAJB3BmrOO4i3DMfSBLuIMNOexBIzGQtK4IowLygUjSEkUdyF252tTTxUL8oaHIXiHi59a5ewvu4cCOWmyA4BR4EsnkE88owh2HtzTlMMLxK5Jf1oVMHQM0AOikC/kqPDtMOJRMxYqiaN27XCXAvxaBN/z5DVSA9d6ZyLn86aBMX0h//jzhNiBnfXo8Cf/jbVxtotxrQ28zZvWc1lNGMaw45lVR1OTdE7pN6a8/8hcyXgnFerHgF78MmlPGrFcYQomM3HozSQi15QuQXF0S65KeMfwtwil+HUo4xVQo4RRToYRTTIUSTjEVSjjFVCjhFFOhhFNMxYKESy8yqCqE5wC8ugGu7viLnjWwIOEC9vyV7QMB3lnDmlekvmElYNUixhhrbb3CwNvLrDayp3CyqssEFxDvajG7lUfWFwS7gXCUXYGfovEemcq/SrgjVjlGDsBSkC3OA6jgGCqcRAAWfF6NQtitS+HvJhw5XtTP3vFmhhwU/nNbKlxhsP4HqfI4egsnyRWf1zVldOHtEriBcKhdys/e8eZWmPqrxSgnJ1xWJgdEhgonaxTycrsELhOOsEv5OcSMOjEjbnRkyv8AXYTLNrAG4fjCSQQwYnF75uyShaJJFolkyEMit+jx4n72jrf8/UcC/M3H3qv08SAeGkJUzrLI/ch2B+tcqJIcKJykAcSdy36kU9n9uQK72an3NlgYX25oDEi7hJ994xX+qm2t9HY89muRF32pkf1g7A48/8uXp+FZhHvtyr5vf1o4A70azyKcYnko4RRToYRTTIUSTjEVSjjFVPwDOYdllNxtl40AAAAASUVORK5CYII=" alt="" />

五、serialVersionUID的取值

  serialVersionUID的取值是Java运行时环境根据类的内部细节自动生成的。如果对类的源代码作了修改,再重新编译,新生成的类文件的serialVersionUID的取值有可能也会发生变化。
  类的serialVersionUID的默认值完全依赖于Java编译器的实现,对于同一个类,用不同的Java编译器编译,有可能会导致不同的
serialVersionUID,也有可能相同。为了提高serialVersionUID的独立性和确定性,强烈建议在一个可序列化类中显示的定义serialVersionUID,为它赋予明确的值

  显式地定义serialVersionUID有两种用途:
    1、 在某些场合,希望类的不同版本对序列化兼容,因此需要确保类的不同版本具有相同的serialVersionUID;
    2、 在某些场合,不希望类的不同版本对序列化兼容,因此需要确保类的不同版本具有不同的serialVersionUID。

六、控制对象的序列化和反序列化

控制序列化就是有选择的序列化对象,而不是把对象的所以内容都序列化,前篇我们的例子中介绍了transit变量和类变量(static)不被序列化,现在我们还有一种更为灵活的控制对象序列化和反序列方法,可以在序列化过程中储存其他非this对象包含的数据

我们现在再来介绍一个接口 java.io.Externalizable 。当对象实现了这个接口时,就可以灵活的控制它的序列化和反序列过程,这个接口继承了java.io.Serializable

Externalizable 接口定义了两个方法,writerExternal方法在序列化时被调用,可以再该方法中控制序列化内容,readExternal方法在反序列时被调用,可以在该方法中控制反序列的内容

好了,现在我们改写上例的UserInfo

import java.io.*;
import java.util.*; //本程序通过实现Externalizable接口控制对象序列化和反序列
public class UserInfo implements Externalizable {
public String userName;
public String userPass;
public int userAge; public UserInfo(){
} public UserInfo(String username,String userpass,int userage){
this.userName=username;
this.userPass=userpass;
this.userAge=userage;
} //当序列化对象时,该方法自动调用
public void writeExternal(ObjectOutput out) throws IOException{
System.out.println("现在执行序列化方法");
//可以在序列化时写非自身的变量
Date d=new Date();
out.writeObject(d);
//只序列化userName,userPass变量
out.writeObject(userName);
out.writeObject(userPass);
} //当反序列化对象时,该方法自动调用
public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException{
System.out.println("现在执行反序列化方法");
Date d=(Date)in.readObject();
System.out.println(d);
this.userName=(String)in.readObject();
this.userPass=(String)in.readObject();
} public String toString(){
return "用户名: "+this.userName+";密码:"+this.userPass+
";年龄:"+this.userAge;
}
}

代码

改写测试类

import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Date;
import java.lang.management.*;
public class Test { //序列化对象到文件
public static void serialize(String fileName){
try
{
//创建一个对象输出流,讲对象输出到文件
ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream(fileName)); UserInfo user=new UserInfo("renyanwei","888888",20);
out.writeObject(user); //序列化一个会员对象 out.close();
}
catch (Exception x)
{
System.out.println(x.toString());
} }
//从文件反序列化到对象
public static void deserialize(String fileName){
try
{
//创建一个对象输入流,从文件读取对象
ObjectInputStream in=new ObjectInputStream(new FileInputStream(fileName)); //读取UserInfo对象并调用它的toString()方法
UserInfo user=(UserInfo)(in.readObject());
System.out.println(user.toString()); in.close();
}
catch (Exception x)
{
System.out.println(x.toString());
} } public static void main(String[] args) { serialize("D:\\test.txt");
System.out.println("序列化完毕"); deserialize("D:\\test.txt");
System.out.println("反序列化完毕");
} }

代码

执行结果

现在执行序列化方法
序列化完毕
现在执行反序列化方法
Thu Oct 23 22:18:12 CST 2008
用户名: renyanwei;密码:888888;年龄:0
反序列化完毕

通过一张图来看程序流程

Java基础知识:序列化和反序列化

首先,我们在序列化UserInfo对象的时候,由于这个类实现了Externalizable 接口,在writeExternal()方法里定义了哪些属性可以序列化,哪些不可以序列化,所以,对象在经过这里就把规定能被序列化的序列化保存文件,不能序列化的不处理,然后在反序列的时候自动调用readExternal()方法,根据序列顺序挨个读取进行反序列,并自动封装成对象返回,然后在测试类接收,就完成了反序列

推荐阅读   《关于 Java 对象序列化您不知道的 5 件事》 www.ibm.com/developerworks/cn/java/j-5things1/

上一篇:Python(九)Tornado web 框架


下一篇:DNN设置皮肤出错后如何还原默认皮肤