JDBC 중개자 직렬화
JDBC DMS에서 생성된 DataGraph는 직렬화되고 파일로 작성되거나 네트워크를 통해 전송할 수 있습니다.
다음 예제는 그래프의 직렬화 및 직렬화 해제를 설명합니다.
// This example assumes the creation of the Customer
// metadata and the JDBC DMS.
DataObject object = mediator.getGraph();
DataGraph origGraph = object.getDataGraph();
FileOutputStream out = new FileOutputStream("test.datagraph");
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(origGraph);
out.close();
FileInputStream in = new FileInputStream("test.datagraph");
ObjectInputStream oin = new ObjectInputStream(in);
DataGraph graph = (DataGraph) oin.readObject();
DataObject obj = (DataObject) graph.getRootObject();
// Now, the DataObject retrieved from the input stream
// obj is equal to the original variable object put
// through the output stream.