// Path: library/src/main/java/com/danikula/videocache/Cache.java
// public interface Cache {
// 
//     long available() throws ProxyCacheException;
// 
//     int read(byte[] buffer, long offset, int length) throws ProxyCacheException;
// 
//     void append(byte[] data, int length) throws ProxyCacheException;
// 
//     void close() throws ProxyCacheException;
// 
//     void complete() throws ProxyCacheException;
// 
//     boolean isCompleted();
// }
// 
// Path: library/src/main/java/com/danikula/videocache/ProxyCacheException.java
// public class ProxyCacheException extends Exception {
// 
//     private static final String LIBRARY_VERSION = ". Version: " + BuildConfig.VERSION_NAME;
// 
//     public ProxyCacheException(String message) {
//         super(message + LIBRARY_VERSION);
//     }
// 
//     public ProxyCacheException(String message, Throwable cause) {
//         super(message + LIBRARY_VERSION, cause);
//     }
// 
//     public ProxyCacheException(Throwable cause) {
//         super("No explanation error" + LIBRARY_VERSION, cause);
//     }
// }


import com.danikula.videocache.Cache;
import com.danikula.videocache.ProxyCacheException;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
package com.danikula.videocache.file;



/**
 * {@link Cache} that uses file for storing data.
 *
 * @author Alexey Danilov (danikula@gmail.com).
 */
public class FileCache implements Cache {

    private static final String TEMP_POSTFIX = ".download";

    private final DiskUsage diskUsage;
    public File file;
    private RandomAccessFile dataFile;

// Path: library/src/main/java/com/danikula/videocache/Cache.java
// public interface Cache {
// 
//     long available() throws ProxyCacheException;
// 
//     int read(byte[] buffer, long offset, int length) throws ProxyCacheException;
// 
//     void append(byte[] data, int length) throws ProxyCacheException;
// 
//     void close() throws ProxyCacheException;
// 
//     void complete() throws ProxyCacheException;
// 
//     boolean isCompleted();
// }
// 
// Path: library/src/main/java/com/danikula/videocache/ProxyCacheException.java
// public class ProxyCacheException extends Exception {
// 
//     private static final String LIBRARY_VERSION = ". Version: " + BuildConfig.VERSION_NAME;
// 
//     public ProxyCacheException(String message) {
//         super(message + LIBRARY_VERSION);
//     }
// 
//     public ProxyCacheException(String message, Throwable cause) {
//         super(message + LIBRARY_VERSION, cause);
//     }
// 
//     public ProxyCacheException(Throwable cause) {
//         super("No explanation error" + LIBRARY_VERSION, cause);
//     }
// }


// Path: library/src/main/java/com/danikula/videocache/file/FileCache.java
import com.danikula.videocache.Cache;
import com.danikula.videocache.ProxyCacheException;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

package com.danikula.videocache.file;



/**
 * {@link Cache} that uses file for storing data.
 *
 * @author Alexey Danilov (danikula@gmail.com).
 */
public class FileCache implements Cache {

    private static final String TEMP_POSTFIX = ".download";

    private final DiskUsage diskUsage;
    public File file;
    private RandomAccessFile dataFile;

    public FileCache(File file) throws ProxyCacheException {