// Path: library/src/main/java/com/danikula/videocache/SourceInfo.java
// public class SourceInfo {
// 
//     public final String url;
//     public final long length;
//     public final String mime;
// 
//     public SourceInfo(String url, long length, String mime) {
//         this.url = url;
//         this.length = length;
//         this.mime = mime;
//     }
// 
//     @Override
//     public String toString() {
//         return "SourceInfo{" +
//                 "url='" + url + '\'' +
//                 ", length=" + length +
//                 ", mime='" + mime + '\'' +
//                 '}';
//     }
// }
// 
// Path: library/src/main/java/com/danikula/videocache/Preconditions.java
// public static void checkAllNotNull(Object... references) {
//     for (Object reference : references) {
//         if (reference == null) {
//             throw new NullPointerException();
//         }
//     }
// }
// 
// Path: library/src/main/java/com/danikula/videocache/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//     if (reference == null) {
//         throw new NullPointerException();
//     }
//     return reference;
// }


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.danikula.videocache.SourceInfo;
import static com.danikula.videocache.Preconditions.checkAllNotNull;
import static com.danikula.videocache.Preconditions.checkNotNull;
package com.danikula.videocache.sourcestorage;




/**
 * Database based {@link SourceInfoStorage}.
 *
 * @author Alexey Danilov (danikula@gmail.com).
 */
class DatabaseSourceInfoStorage extends SQLiteOpenHelper implements SourceInfoStorage {

    private static final String TABLE = "SourceInfo";
    private static final String COLUMN_ID = "_id";
    private static final String COLUMN_URL = "url";
    private static final String COLUMN_LENGTH = "length";
    private static final String COLUMN_MIME = "mime";
    private static final String[] ALL_COLUMNS = new String[]{COLUMN_ID, COLUMN_URL, COLUMN_LENGTH, COLUMN_MIME};
    private static final String CREATE_SQL =
            "CREATE TABLE " + TABLE + " (" +
                    COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," +
                    COLUMN_URL + " TEXT NOT NULL," +
                    COLUMN_MIME + " TEXT," +
                    COLUMN_LENGTH + " INTEGER" +
                    ");";

    DatabaseSourceInfoStorage(Context context) {
        super(context, "AndroidVideoCache.db", null, 1);
// Path: library/src/main/java/com/danikula/videocache/SourceInfo.java
// public class SourceInfo {
// 
//     public final String url;
//     public final long length;
//     public final String mime;
// 
//     public SourceInfo(String url, long length, String mime) {
//         this.url = url;
//         this.length = length;
//         this.mime = mime;
//     }
// 
//     @Override
//     public String toString() {
//         return "SourceInfo{" +
//                 "url='" + url + '\'' +
//                 ", length=" + length +
//                 ", mime='" + mime + '\'' +
//                 '}';
//     }
// }
// 
// Path: library/src/main/java/com/danikula/videocache/Preconditions.java
// public static void checkAllNotNull(Object... references) {
//     for (Object reference : references) {
//         if (reference == null) {
//             throw new NullPointerException();
//         }
//     }
// }
// 
// Path: library/src/main/java/com/danikula/videocache/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//     if (reference == null) {
//         throw new NullPointerException();
//     }
//     return reference;
// }


// Path: library/src/main/java/com/danikula/videocache/sourcestorage/DatabaseSourceInfoStorage.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.danikula.videocache.SourceInfo;
import static com.danikula.videocache.Preconditions.checkAllNotNull;
import static com.danikula.videocache.Preconditions.checkNotNull;

package com.danikula.videocache.sourcestorage;




/**
 * Database based {@link SourceInfoStorage}.
 *
 * @author Alexey Danilov (danikula@gmail.com).
 */
class DatabaseSourceInfoStorage extends SQLiteOpenHelper implements SourceInfoStorage {

    private static final String TABLE = "SourceInfo";
    private static final String COLUMN_ID = "_id";
    private static final String COLUMN_URL = "url";
    private static final String COLUMN_LENGTH = "length";
    private static final String COLUMN_MIME = "mime";
    private static final String[] ALL_COLUMNS = new String[]{COLUMN_ID, COLUMN_URL, COLUMN_LENGTH, COLUMN_MIME};
    private static final String CREATE_SQL =
            "CREATE TABLE " + TABLE + " (" +
                    COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," +
                    COLUMN_URL + " TEXT NOT NULL," +
                    COLUMN_MIME + " TEXT," +
                    COLUMN_LENGTH + " INTEGER" +
                    ");";

    DatabaseSourceInfoStorage(Context context) {
        super(context, "AndroidVideoCache.db", null, 1);
        checkNotNull(context);