System.out
.println("****************sampleObjectAction()************************");
long gStart = System.currentTimeMillis();
// Serialize object
long start = System.currentTimeMillis();
ZipFile zFileBef = new ZipFile(new File("samplefiles/sample00.docx"));
StringWriter stringWriter = new StringWriter();
ObjectOutputStream out = X_STREAM
.createObjectOutputStream(stringWriter);
out.writeObject(zFileBef);
out.close();
String data = stringWriter.toString();
System.out.printf("Serialization delay : %s\n", (System
.currentTimeMillis() - start));
// Deserialize object
start = System.currentTimeMillis();
StringReader stringReader = new StringReader(data);
ObjectInputStream in = X_STREAM.createObjectInputStream(stringReader);
ZipFile zFileAft = (ZipFile) in.readObject();
System.out.printf("Deserialization delay : %s\n", (System
.currentTimeMillis() - start));
// Check objects validity
// --Original stream
start = System.currentTimeMillis();
InputStream inStreamBef = zFileBef.getInputStream(zFileBef
.getEntry("word/document.xml"));
Document coreDocumentBef = SAX_READER.read(inStreamBef);
System.out.printf("Create XML document delay : %s\n", (System
.currentTimeMillis() - start));
// --Deserialized stream
start = System.currentTimeMillis();
InputStream inStreamAft = zFileAft.getInputStream(zFileAft
.getEntry("word/document.xml"));
Document coreDocumentAft = SAX_READER.read(inStreamAft);
System.out.printf("Create XML document delay : %s\n", (System
.currentTimeMillis() - start));
System.out.printf("Global delay inter : %s\n", (System