|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
public interface Externalizable
Externalizable ʵ�����Ψһ�����ǿ��Ա�д�����л����У����ฺ�𱣴�ͻָ�ʵ�����ݡ�
��ij��Ҫ��ȫ����ijһ�����䳬���͵�����ʽ�����ݣ�����Ҫʵ�� Externalizable �ӿڵ� writeExternal �� readExternal ��������Щ����������ʽ�볬���ͽ���Э���Ա�����״̬����Щ���������涨�Ƶ� writeObject �� readObject ����ʵ�֡�
Serialization ����ʹ�� Serializable �� Externalizable �ӿڡ�����־��Ի���Ҳ����ʹ�����ǡ�Ҫ�洢��ÿ��������Ҫ����Ƿ�֧�� Externalizable �ӿڡ��������֧�� Externalizable������� writeExternal �������������֧�� Externalizable ��ʵ���� Serializable����ʹ�� ObjectOutputStream ����ö���
���ع� Externalizable ����ʱ����ʹ�������Ĺ������췽������һ��ʵ����Ȼ����� readExternal ������ͨ���� ObjectInputStream �ж�ȡ Serializable ������Իָ���Щ����
Externalizable ʵ������ͨ�� Serializable �ӿ��м�¼�� writeReplace �� readResolve ������ָ��һ���������
ObjectOutputStream
,
ObjectInputStream
,
ObjectOutput
,
ObjectInput
,
Serializable
����ժҪ | |
---|---|
void |
readExternal(ObjectInput in)
����ʵ�� readExternal �������ָ������ݣ���ͨ������ DataInput �ķ������ָ���������ͣ����� readObject ���ָ������ַ��������顣 |
void |
writeExternal(ObjectOutput out)
�ö����ʵ�� writeExternal ���������������ݣ�������ͨ������ DataOutput �ķ��������������ֵ������� ObjectOutput �� writeObject ��������������ַ��������顣 |
������ϸ��Ϣ |
---|
void writeExternal(ObjectOutput out) throws IOException
out
- Ҫд��������
IOException
- �������ܷ��������� I/O �쳣void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
in
- Ϊ�˻ָ���������ж�ȡ���ݵ���
IOException
- ������� I/O ����
ClassNotFoundException
- ������ҵ���Ҫ�ָ���ij��������ࡣ
|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������