Class CopyCompare
- java.lang.Object
-
- org.apache.poi.examples.hpsf.CopyCompare
-
public final class CopyCompare extends 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
PropertySetof an original property set, creates aPropertySetand writes thePropertySetto 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 attributes, and the sections must contain the same properties. Details like the ordering of the properties do not matter.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancompare(String originalFileName, String copyFileName)static voidhandleEvent(POIFSFileSystem poiFs, POIFSReaderEvent event)The method is called by POI's eventing API for each file in the origin POIFS.static voidmain(String[] args)Runs the example program.
-
-
-
Method Detail
-
main
public static void main(String[] args) throws IOException
Runs the example program. The application expects one or two arguments:- The first argument is the disk file name of the POI filesystem to copy.
- 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:
IOException- if any I/O exception occurs.UnsupportedEncodingException- if a character encoding is not supported.
-
compare
public static boolean compare(String originalFileName, String copyFileName) throws IOException
- Throws:
IOException
-
handleEvent
public static void handleEvent(POIFSFileSystem poiFs, POIFSReaderEvent event)
The method is called by POI's eventing API for each file in the origin POIFS.
-
-