private static void serializeToDiskSynchronously(String cacheKey,String controllerJson){
  OutputStream outputStream=null;
  try {
    outputStream=controllerDiskCache.openPutStream(cacheKey);
    outputStream.write(controllerJson.getBytes());
  }
 catch (  IOException e) {
    Log.e(TAG,"Unable to serialize controller to disk",e);
  }
 finally {
    if (outputStream != null) {
      Utility.closeQuietly(outputStream);
    }
  }
}

private static void serializeToDiskSynchronously ( String cacheKey , String controllerJson ) { OutputStream outputStream = null ; try { outputStream = controllerDiskCache . openPutStream ( cacheKey ) ; outputStream . write ( controllerJson . getBytes ( ) ) ; } catch ( IOException e ) { Log . e ( TAG , "Unable to serialize controller to disk" , e ) ; } finally { if ( outputStream != null ) { Utility . closeQuietly ( outputStream ) ; } } }
note : this must be called only via the serializetodiskworkitem class to ensure that it happens on the right thread , at the right time .
