// Path: library/src/main/java/fr/prcaen/externalresources/Cache.java
// public final class Cache {
//   public static final int POLICY_NONE = 0;
//   public static final int POLICY_OFFLINE = 1;
//   public static final int POLICY_ALL = 2;
//   protected static final int MIN_DISK_CACHE_SIZE = 5 * 1024 * 1024;  // 5MB
//   protected static final int MAX_DISK_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
//   private static final String EXTERNAL_RESOURCES_FILE_NAME_CACHE = "external-resources-cache";
//   private final File cacheDir;
//   private final long cacheSize;
// 
//   @Retention(RetentionPolicy.SOURCE) @IntDef({
//       POLICY_NONE, POLICY_OFFLINE, POLICY_ALL
//   }) public @interface Policy {
//   }
// 
//   public Cache(Context context) {
//     this.cacheDir = createDefaultCacheDir(context.getApplicationContext());
//     this.cacheSize = calculateDiskCacheSize(cacheDir);
//   }
// 
//   private static File createDefaultCacheDir(Context context) {
//     File cache = new File(context.getCacheDir(), EXTERNAL_RESOURCES_FILE_NAME_CACHE);
// 
//     if (!cache.exists()) {
//       //noinspection ResultOfMethodCallIgnored
//       cache.mkdirs();
//     }
// 
//     return cache;
//   }
// 
//   @SuppressWarnings("deprecation") public static long calculateDiskCacheSize(File dir) {
//     long size = MIN_DISK_CACHE_SIZE;
// 
//     try {
//       StatFs statFs = new StatFs(dir.getAbsolutePath());
//       final long available;
// 
//       if (SDK_INT < JELLY_BEAN_MR2) {
//         available = ((long) statFs.getBlockCount()) * statFs.getBlockSize();
//       } else {
//         available = statFs.getBlockCountLong() * statFs.getBlockSizeLong();
//       }
// 
//       size = available / 50;
//     } catch (IllegalArgumentException ignored) {
//     }
// 
//     return Math.max(Math.min(size, MAX_DISK_CACHE_SIZE), MIN_DISK_CACHE_SIZE);
//   }
// 
//   public File getCacheDir() {
//     return cacheDir;
//   }
// 
//   public long getCacheSize() {
//     return cacheSize;
//   }
// }


import fr.prcaen.externalresources.Cache;
package fr.prcaen.externalresources.exception;


public final class ResponseException extends ExternalResourceException {

  private final boolean localCacheOnly;
  private final int responseCode;

// Path: library/src/main/java/fr/prcaen/externalresources/Cache.java
// public final class Cache {
//   public static final int POLICY_NONE = 0;
//   public static final int POLICY_OFFLINE = 1;
//   public static final int POLICY_ALL = 2;
//   protected static final int MIN_DISK_CACHE_SIZE = 5 * 1024 * 1024;  // 5MB
//   protected static final int MAX_DISK_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
//   private static final String EXTERNAL_RESOURCES_FILE_NAME_CACHE = "external-resources-cache";
//   private final File cacheDir;
//   private final long cacheSize;
// 
//   @Retention(RetentionPolicy.SOURCE) @IntDef({
//       POLICY_NONE, POLICY_OFFLINE, POLICY_ALL
//   }) public @interface Policy {
//   }
// 
//   public Cache(Context context) {
//     this.cacheDir = createDefaultCacheDir(context.getApplicationContext());
//     this.cacheSize = calculateDiskCacheSize(cacheDir);
//   }
// 
//   private static File createDefaultCacheDir(Context context) {
//     File cache = new File(context.getCacheDir(), EXTERNAL_RESOURCES_FILE_NAME_CACHE);
// 
//     if (!cache.exists()) {
//       //noinspection ResultOfMethodCallIgnored
//       cache.mkdirs();
//     }
// 
//     return cache;
//   }
// 
//   @SuppressWarnings("deprecation") public static long calculateDiskCacheSize(File dir) {
//     long size = MIN_DISK_CACHE_SIZE;
// 
//     try {
//       StatFs statFs = new StatFs(dir.getAbsolutePath());
//       final long available;
// 
//       if (SDK_INT < JELLY_BEAN_MR2) {
//         available = ((long) statFs.getBlockCount()) * statFs.getBlockSize();
//       } else {
//         available = statFs.getBlockCountLong() * statFs.getBlockSizeLong();
//       }
// 
//       size = available / 50;
//     } catch (IllegalArgumentException ignored) {
//     }
// 
//     return Math.max(Math.min(size, MAX_DISK_CACHE_SIZE), MIN_DISK_CACHE_SIZE);
//   }
// 
//   public File getCacheDir() {
//     return cacheDir;
//   }
// 
//   public long getCacheSize() {
//     return cacheSize;
//   }
// }


// Path: library/src/main/java/fr/prcaen/externalresources/exception/ResponseException.java
import fr.prcaen.externalresources.Cache;

package fr.prcaen.externalresources.exception;


public final class ResponseException extends ExternalResourceException {

  private final boolean localCacheOnly;
  private final int responseCode;

  public ResponseException(String message, @Cache.Policy int networkPolicy, int responseCode) {