public static synchronized void load() { if (instance == null) { instance = new SQLiteLibraryLoader(); } instance.doLoad(); }
public static DataSource toDataSource(FileDescriptor fd) { return toDataSource(fd, 0, 0); }
public static DataSource toDataSource(String path) { return new DataSource(path); }
private String getNativesResourcesPathPart() { return getOsPrefix() + "-" + getArchitectureSuffix(); }
public String getLibClasspathResourceName() { return getNativesResourcesPathPart() + "/" + getNativesResourcesFilePart(); }
private ByteSource getLibraryByteSource() { return Resources.asByteSource(Resources.getResource(getLibClasspathResourceName())); }
private String getLibName() { return libraryNameMapper.mapLibraryName(SQLITE4JAVA); }
@Before public void setUp() { loader = new SQLiteLibraryLoader(); }
private String getNativesResourcesFilePart() { return getLibName().replace(".dylib", ".jnilib"); }
private void logWithTime(final String message, final long startTime) { log(message + " " + (System.currentTimeMillis() - startTime)); }
public static DataSource toDataSource(String uri, Map<String, String> headers) { return toDataSource(uri); }
private String loadLibrary(SQLiteLibraryLoader loader, String name, String arch) throws IOException { setNameAndArch(name, arch); return loader.getLibClasspathResourceName(); }
public static DataSource toDataSource(Context context, Uri uri, Map<String, String> headers) { return toDataSource(context, uri); }
@SuppressWarnings("ObjectToString") public static DataSource toDataSource(FileDescriptor fd, long offset, long length) { return toDataSource(fd.toString() + offset); }
public static DataSource toDataSource(Context context, Uri uri) { return toDataSource(uri.toString()); }
/** * Adds the given keyCode/value pair for the given data source. * Uses <tt>path</tt> to call {@link org.robolectric.shadows.util.DataSource#toDataSource(String)} and * then calls {@link #addMetadata(DataSource, int, String)}. This * method is retained mostly for backwards compatibility; * you can call {@link #addMetadata(DataSource, int, String)} directly. * * @param path the path to the data source whose metadata is being set. * @param keyCode the keyCode for the metadata being set, as used by {@link MediaMetadataRetriever#extractMetadata(int)}. * @param value the value for the specified metadata. */ public static void addMetadata(String path, int keyCode, String value) { addMetadata(toDataSource(path), keyCode, value); }
/** * Adds the given bitmap at the given time for the given data source. * Uses <tt>path</tt> to call {@link org.robolectric.shadows.util.DataSource#toDataSource(FileDescriptor)} and * then calls {@link #addFrame(DataSource, long, Bitmap)}. This * method is retained mostly for backwards compatibility; * you can call {@link #addFrame(DataSource, long, Bitmap)} directly. * * @param fd file descriptor of the data source. * @param time the playback time at which the specified bitmap * should be retrieved. * @param bitmap the bitmap to retrieve. */ public static void addFrame(FileDescriptor fd, long time, Bitmap bitmap) { addFrame(toDataSource(fd), time, bitmap); }
/** * Adds the given bitmap at the given time for the given data source. * Uses <tt>path</tt> to call {@link org.robolectric.shadows.util.DataSource#toDataSource(String)} and * then calls {@link #addFrame(DataSource, long, Bitmap)}. This * method is retained mostly for backwards compatibility; * you can call {@link #addFrame(DataSource, long, Bitmap)} directly. * * @param path the path to the data source. * @param time the playback time at which the specified bitmap * should be retrieved. * @param bitmap the bitmap to retrieve. */ public static void addFrame(String path, long time, Bitmap bitmap) { addFrame(toDataSource(path), time, bitmap); }
/** * Adds the given bitmap at the given time for the given data source. * Uses <tt>path</tt> to call {@link org.robolectric.shadows.util.DataSource#toDataSource(String, Map)} and * then calls {@link #addFrame(DataSource, long, Bitmap)}. This * method is retained mostly for backwards compatibility; * you can call {@link #addFrame(DataSource, long, Bitmap)} directly. * * @param uri the Uri of the data source. * @param headers the headers to use when requesting the specified uri. * @param time the playback time at which the specified bitmap * should be retrieved. * @param bitmap the bitmap to retrieve. */ public static void addFrame(String uri, Map<String, String> headers, long time, Bitmap bitmap) { addFrame(toDataSource(uri, headers), time, bitmap); }
@Implementation protected void setDataSource(Context context, Uri uri, Map<String, String> headers) throws IOException { setDataSource(toDataSource(context, uri, headers)); sourceUri = uri; }