@ Override public FileBuilder addFile ( Path source , Path target ) throws IOException { checkTarget ( target ) ; FileBuilder fb = new FileBuilder ( ) ; fb . target = target ; fb . size = ( int ) Files . size ( source ) ; try ( FileChannel fc = FileChannel . open ( source , READ ) ) { fb . content = fc . map ( FileChannel . MapMode . READ_ONLY , 0 , fb . size ) ; } FileTime fileTime = Files . getLastModifiedTime ( source ) ; fb . time = ( int ) fileTime . to ( TimeUnit . SECONDS ) ; fb . compressFilename ( ) ; fileBuilders . add ( fb ) ; return fb ; }
Add file to package from path .