private void rebuildJournal() throws IOException {
        if (mJournalWriter != null) {
            mJournalWriter.close();
        }

        Writer writer = new BufferedWriter(new FileWriter(mJournalFileTmp), IO_BUFFER_SIZE);
        writer.write(MAGIC);
        writer.write("\n");
        writer.write(VERSION_1);
        writer.write("\n");
        writer.write(Integer.toString(mAppVersion));
        writer.write("\n");
        writer.write("\n");

        for (CacheEntry cacheEntry : mLruEntries.values()) {
            if (cacheEntry.isUnderEdit()) {
                writer.write(sACTION_LIST[ACTION_DIRTY] + ' ' + cacheEntry.getKey() + " " + cacheEntry.getSize() + '\n');
            } else {
                writer.write(sACTION_LIST[ACTION_CLEAN] + ' ' + cacheEntry.getKey() + " " + cacheEntry.getSize() + '\n');
            }
        }

        writer.close();
        mJournalFileTmp.renameTo(mJournalFile);
        mJournalWriter = new BufferedWriter(new FileWriter(mJournalFile, true), IO_BUFFER_SIZE);
    }
private void rebuildJournal() throws IOException {
        if (mJournalWriter != null) {
            mJournalWriter.close();
        }

        Writer writer = new BufferedWriter(new FileWriter(mJournalFileTmp), IO_BUFFER_SIZE);
        writer.write(MAGIC);
        writer.write("\n");
        writer.write(VERSION_1);
        writer.write("\n");
        writer.write(Integer.toString(mAppVersion));
        writer.write("\n");
        writer.write("\n");

        for (CacheEntry cacheEntry : mLruEntries.values()) {
            if (cacheEntry.isUnderEdit()) {
                writer.write(sACTION_LIST[ACTION_DIRTY] + ' ' + cacheEntry.getKey() + " " + cacheEntry.getSize() + '\n');
            } else {
                writer.write(sACTION_LIST[ACTION_CLEAN] + ' ' + cacheEntry.getKey() + " " + cacheEntry.getSize() + '\n');
            }
        }

        writer.close();
        mJournalFileTmp.renameTo(mJournalFile);
        mJournalWriter = new BufferedWriter(new FileWriter(mJournalFile, true), IO_BUFFER_SIZE);
    }
private void rebuildJournal ( ) throws IOException { if ( mJournalWriter != null ) { mJournalWriter . close ( ) ; } Writer writer = new BufferedWriter ( new FileWriter ( mJournalFileTmp ) , IO_BUFFER_SIZE ) ; writer . write ( MAGIC ) ; writer . write ( "\n" ) ; writer . write ( VERSION_1 ) ; writer . write ( "\n" ) ; writer . write ( Integer . toString ( mAppVersion ) ) ; writer . write ( "\n" ) ; writer . write ( "\n" ) ; for ( CacheEntry cacheEntry : mLruEntries . values ( ) ) { if ( cacheEntry . isUnderEdit ( ) ) { writer . write ( sACTION_LIST [ ACTION_DIRTY ] + ' ' + cacheEntry . getKey ( ) + " " + cacheEntry . getSize ( ) + ' ' ) ; } else { writer . write ( sACTION_LIST [ ACTION_CLEAN ] + ' ' + cacheEntry . getKey ( ) + " " + cacheEntry . getSize ( ) + ' ' ) ; } } writer . close ( ) ; mJournalFileTmp . renameTo ( mJournalFile ) ; mJournalWriter = new BufferedWriter ( new FileWriter ( mJournalFile , true ) , IO_BUFFER_SIZE ) ; }
Creates a new journal that omits redundant information. This replaces the
current journal if it exists.
Creates a new journal that omits redundant information . This replaces the current journal if it exists .