org.apache.poi.hpsf.examples
Class CopyCompare

java.lang.Object
  extended by org.apache.poi.hpsf.examples.CopyCompare

public class CopyCompare
extends java.lang.Object

This class copies a POI file system to a new file and compares the copy with the original.

Property set streams are copied logically, i.e. the application establishes a PropertySet of an original property set, creates a MutablePropertySet from the PropertySet and writes the MutablePropertySet to the destination POI file system. - Streams which are no property set streams are copied bit by bit.

The comparison of the POI file systems is done logically. That means that the two disk files containing the POI file systems do not need to be exactly identical. However, both POI file systems must contain the same files, and most of these files must be bitwise identical. Property set streams, however, are compared logically: they must have the same sections with the same attributs, and the sections must contain the same properties. Details like the ordering of the properties do not matter.

Since:
2003-09-19
Version:
$Id: CopyCompare.java 489730 2006-12-22 19:18:16Z bayard $
Author:
Rainer Klute <klute@rainer-klute.de>

Constructor Summary
CopyCompare()
           
 
Method Summary
static void main(java.lang.String[] args)
          Runs the example program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyCompare

public CopyCompare()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws NoPropertySetStreamException,
                        MarkUnsupportedException,
                        java.io.UnsupportedEncodingException,
                        java.io.IOException

Runs the example program. The application expects one or two arguments:

  1. The first argument is the disk file name of the POI filesystem to copy.

  2. The second argument is optional. If it is given, it is the name of a disk file the copy of the POI filesystem will be written to. If it is not given, the copy will be written to a temporary file which will be deleted at the end of the program.

Parameters:
args - Command-line arguments.
Throws:
MarkUnsupportedException - if a POI document stream does not support the mark() operation.
NoPropertySetStreamException - if the application tries to create a property set from a POI document stream that is not a property set stream.
java.io.IOException - if any I/O exception occurs.
java.io.UnsupportedEncodingException - if a character encoding is not supported.


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.