question: private static void copyFiles ( Manifest manifest , JarFile in , JarOutputStream out , long timestamp ) throws IOException { byte [ ] buffer = new byte [ 4096 ] ; int num ; Map < String , Attributes > entries = manifest . getEntries ( ) ; List < String > names = new ArrayList < > ( entries . keySet ( ) ) ; Collections . sort ( names ) ; for ( String name : names ) { JarEntry inEntry = in . getJarEntry ( name ) ; JarEntry outEntry = null ; if ( inEntry . getMethod ( ) == JarEntry . STORED ) { outEntry = new JarEntry ( inEntry ) ; } else { outEntry = new JarEntry ( name ) ; } outEntry . setTime ( timestamp ) ; out . putNextEntry ( outEntry ) ; InputStream data = in . getInputStream ( inEntry ) ; while ( ( num = data . read ( buffer ) ) > 0 ) { out . write ( buffer , 0 , num ) ; } out . flush ( ) ; } }
target:  Copy all the files in a manifest from input to output. We set the modification times in the output to a fixed time, so as to reduce variation in the output file and make incremental OTAs more efficient.