public synchronized void consolidateSoftCopy ( ) throws IOException { if ( isSoftCopy == true ) { ArrayList < NikeFS2Block > copyBlocks = new ArrayList < NikeFS2Block > ( ) ; if ( blocks . size ( ) > 0 ) { // make copies of all contained blocks byte [ ] buffer = new byte [ blocks . get ( 0 ) . size ( ) ] ; for ( NikeFS2Block block : blocks ) { NikeFS2Block copyBlock = vfs . allocateBlock ( ) ; block . read ( 0 , buffer ) ; copyBlock . write ( 0 , buffer ) ; copyBlocks . add ( copyBlock ) ; } } // replace blocks list blocks = copyBlocks ; isSoftCopy = false ; // deregister from template parent . deregisterSoftCopy ( this ) ; parent = null ; } }
Consolidates this soft copy prior to modification . This will detach this instance from its parent creating a true copy of its current data .