public boolean modify ( File file , MP4Edit edit ) throws IOException { SeekableByteChannel fi = null ; try { fi = NIOUtils . rwChannel ( file ) ; List < Tuple . _2 < Atom , ByteBuffer > > fragments = doTheFix ( fi , edit ) ; if ( fragments == null ) return false ; // If everything is clean, only then actually writing stuff to the // file for ( Tuple . _2 < Atom , ByteBuffer > fragment : fragments ) { replaceBox ( fi , fragment . v0 , fragment . v1 ) ; } return true ; } finally { NIOUtils . closeQuietly ( fi ) ; } }
Tries to modify movie header in place according to what s implemented in the edit the file gets pysically modified if the operation is successful . No temporary file is created .