question: public void testmirror ( File orig , File origni , File truecolor ) { File mirror = TestSupport . addSuffixToName ( orig , "_mirror" ) ; File recov = TestSupport . addSuffixToName ( orig , "_recov" ) ; long crc0 = 0 ; boolean interlaced ; boolean palete ; { PngReader pngr = new PngReader ( orig ) ; PngWriter pngw = null ; try { if ( rand . nextBoolean ( ) ) pngr . setLineSetFactory ( ImageLineSetDefault . getFactoryByte ( ) ) ; palete = pngr . imgInfo . indexed ; pngr . prepareSimpleDigestComputation ( ) ; interlaced = pngr . isInterlaced ( ) ; pngw = new PngWriter ( mirror , pngr . imgInfo , true ) ; pngw . setFilterType ( FilterType . FILTER_CYCLIC ) ; pngw . copyChunksFrom ( pngr . getChunksList ( ) ) ; IImageLineSet < ? extends IImageLine > lines = pngr . readRows ( ) ; for ( int row = 0 ; row < pngr . imgInfo . rows ; row ++ ) { mirrorLine ( lines . getImageLine ( row ) , pngr . imgInfo ) ; pngw . writeRow ( lines . getImageLine ( row ) ) ; } pngr . end ( ) ; crc0 = PngHelperInternal . getDigest ( pngr ) ; pngw . end ( ) ; } finally { pngr . close ( ) ; if ( pngw != null ) pngw . close ( ) ; } } { PngReader pngr2 = new PngReader ( mirror ) ; PngWriter pngw = null ; try { if ( pngr2 . imgInfo . bitDepth < 16 && rand . nextBoolean ( ) ) pngr2 . setLineSetFactory ( ImageLineSetDefault . getFactoryByte ( ) ) ; pngw = new PngWriter ( recov , pngr2 . imgInfo , true ) ; pngw . setFilterType ( FilterType . FILTER_DEFAULT ) ; pngw . copyChunksFrom ( pngr2 . getChunksList ( ) ) ; for ( int row = 0 ; row < pngr2 . imgInfo . rows ; row ++ ) { IImageLine line = pngr2 . readRow ( ) ; mirrorLine ( line , pngr2 . imgInfo ) ; pngw . writeRow ( line ) ; } pngr2 . end ( ) ; pngw . end ( ) ; } finally { pngr2 . close ( ) ; if ( pngw != null ) pngw . close ( ) ; } } if ( ! interlaced ) TestSupport . testCrcEquals ( recov , crc0 ) ; else TestSupport . testSameCrc ( recov , origni ) ; if ( interlaced ) additionalTestInterlaced ( orig , origni ) ; if ( palete && truecolor . exists ( ) ) additionalTestPalette ( orig , truecolor ) ; }
target:  Takes a image, mirrors it using row-per-row int reading, mirror it again using byte (if possible) and compares IF the original was interlaced, compares with origni