Class 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 PropertySet of an original property set, creates a PropertySet and writes the PropertySet 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 attributes, and the sections must contain the same properties. Details like the ordering of the properties do not matter.

    • Method Detail

      • main

        public static void main​(String[] args)
                         throws 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:
        IOException - if any I/O exception occurs.
        UnsupportedEncodingException - if a character encoding is not supported.
      • 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.