@Override
    public void writeData(WriterCallback callback, Object debugInfo) throws IOException {
      FileOutputStream fileStream;
      try {
        fileStream = new FileOutputStream(mTemporaryFile);
      } catch (FileNotFoundException fne) {
        mCacheErrorLogger.logError(
            CacheErrorLogger.CacheErrorCategory.WRITE_UPDATE_FILE_NOT_FOUND,
            TAG,
            "updateResource",
            fne);
        throw fne;
      }

      long length;
      try {
        CountingOutputStream countingStream = new CountingOutputStream(fileStream);
        callback.write(countingStream);
        // just in case underlying stream's close method doesn't flush:
        // we flush it manually and inside the try/catch
        countingStream.flush();
        length = countingStream.getCount();
      } finally {
        // if it fails to close (or write the last piece) we really want to know
        // Normally we would want this to be quiet because a closing exception would hide one
        // inside the try, but now we really want to know if something fails at flush or close
        fileStream.close();
      }
      // this code should never throw, but if filesystem doesn't fail on a failing/uncomplete close
      // we want to know and manually fail
      if (mTemporaryFile.length() != length) {
        throw new IncompleteFileException(length, mTemporaryFile.length());
      }
    }
Holds information about the different files this storage uses (content, tmp). All file name
parsing should be done through here. Temp files creation is also handled here, to encapsulate
naming.
imagepipeline-base/src/main/java/com/facebook/cache/disk/DefaultDiskStorage.java