@SuppressLint("EmptyCatchBlock") void rebuild(){
  if (mJournalWriter != null) {
    closeQuietly(mJournalWriter);
  }
  Writer writer=null;
  try {
    ArrayList<Entry> entries=mCache.getEntryCollection();
    mLineCount=entries.size();
    writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(mJournalFileTmp),US_ASCII));
    for (    Entry entry : entries) {
      if (entry.isReadable()) {
        writer.write(CLEAN_ENTRY_PREFIX + ' ' + entry.getKey()+ ' '+ String.valueOf(entry.getLengthInBytes())+ '\n');
      }
 else {
        writer.write(DIRTY_ENTRY_PREFIX + ' ' + entry.getKey()+ '\n');
      }
    }
    writer.flush();
    if (mJournalFile.exists()) {
      mJournalFile.renameTo(mJournalFileBackup);
    }
    mJournalFileTmp.renameTo(mJournalFile);
    createJournalWriter();
    mJournalFileBackup.delete();
  }
 catch (  IOException ignored) {
  }
 finally {
    closeQuietly(writer);
  }
}

@ SuppressLint ( "EmptyCatchBlock" ) void rebuild ( ) { if ( mJournalWriter != null ) { closeQuietly ( mJournalWriter ) ; } Writer writer = null ; try { ArrayList < Entry > entries = mCache . getEntryCollection ( ) ; mLineCount = entries . size ( ) ; writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( mJournalFileTmp ) , US_ASCII ) ) ; for ( Entry entry : entries ) { if ( entry . isReadable ( ) ) { writer . write ( CLEAN_ENTRY_PREFIX + ' ' + entry . getKey ( ) + ' ' + String . valueOf ( entry . getLengthInBytes ( ) ) + '\n' ) ; } else { writer . write ( DIRTY_ENTRY_PREFIX + ' ' + entry . getKey ( ) + '\n' ) ; } } writer . flush ( ) ; if ( mJournalFile . exists ( ) ) { mJournalFile . renameTo ( mJournalFileBackup ) ; } mJournalFileTmp . renameTo ( mJournalFile ) ; createJournalWriter ( ) ; mJournalFileBackup . delete ( ) ; } catch ( IOException ignored ) { } finally { closeQuietly ( writer ) ; } }
creates a new journal that omits redundant journal entries . this replaces the current journal if it exists .
