RenamingDelegatingContext

open class RenamingDelegatingContext : ContextWrapper
kotlin.Any
   ↳ android.content.Context
   ↳ android.content.ContextWrapper
   ↳ android.test.RenamingDelegatingContext

This is a class which delegates to the given context, but performs database and file operations with a renamed database/file name (prefixes default names with a given prefix).

Summary

Inherited constants
Public constructors
<init>(context: Context!, filePrefix: String!)

<init>(context: Context!, fileContext: Context!, filePrefix: String!)

Public methods
open File!

This class was deprecated in API level 21.

open File!

This class was deprecated in API level 21.

open FileInputStream!

This class was deprecated in API level 21.

open Boolean

This class was deprecated in API level 21.

open Array<String!>!

This class was deprecated in API level 21.

open Unit

This class was deprecated in API level 21.

open FileOutputStream!
openFileOutput(name: String!, mode: Int)

This class was deprecated in API level 21.

open String!

This class was deprecated in API level 21.

open File!

This class was deprecated in API level 21.

open SQLiteDatabase!

This class was deprecated in API level 21.

open SQLiteDatabase!

This class was deprecated in API level 21.

open Boolean

This class was deprecated in API level 21.

open Array<String!>!

This class was deprecated in API level 21.

open static T
providerWithRenamedContext(contentProvider: Class<T>!, c: Context!, filePrefix: String!)

This class was deprecated in API level 21.

open static T
providerWithRenamedContext(contentProvider: Class<T>!, c: Context!, filePrefix: String!, allowAccessToExistingFilesAndDbs: Boolean)

This class was deprecated in API level 21.

Inherited functions

Public constructors

<init>

RenamingDelegatingContext(context: Context!, filePrefix: String!)
Parameters
context Context!: : the context that will be delegated.
filePrefix Context!: : a prefix with which database and file names will be prefixed.

<init>

RenamingDelegatingContext(context: Context!, fileContext: Context!, filePrefix: String!)
Parameters
context Context!: : the context that will be delegated.
fileContext Context!: : the context that file and db methods will be delegated to
filePrefix Context!: : a prefix with which database and file names will be prefixed.

Public methods

getDatabasePath

open fun 
        getDatabasePath
(name: String!): File!

Deprecated:

This class was deprecated in API level 21.

Returns the absolute path on the filesystem where a database created with #openOrCreateDatabase is stored.

The returned path may change over time if the calling app is moved to an adopted storage device, so only relative paths should be persisted.

Parameters
name String!: The name of the database for which you would like to get its path.
Return
File!: An absolute path to the given database.

getFileStreamPath

open fun 
        getFileStreamPath
(name: String!): File!

Deprecated:

This class was deprecated in API level 21.

Returns the absolute path on the filesystem where a file created with #openFileOutput is stored.

The returned path may change over time if the calling app is moved to an adopted storage device, so only relative paths should be persisted.

Parameters
name String!: The name of the file for which you would like to get its path.
Return
File!: An absolute path to the given file.

openFileInput

open fun 
        openFileInput
(name: String!): FileInputStream!

Deprecated:

This class was deprecated in API level 21.

Open a private file associated with this Context's application package for reading.

Parameters
name String!: The name of the file to open; can not contain path separators.
Return
FileInputStream!: The resulting FileInputStream.

deleteDatabase

open fun 
        deleteDatabase
(name: String!): Boolean

Deprecated:

This class was deprecated in API level 21.

Delete an existing private SQLiteDatabase associated with this Context's application package.

Parameters
name String!: The name (unique in the application package) of the database.
Return
Boolean: true if the database was successfully deleted; else false.

fileList

open fun 
        fileList
(): Array<String!>!

Deprecated:

This class was deprecated in API level 21.

Returns an array of strings naming the private files associated with this Context's application package.

Return
Array<String!>!: Array of strings naming the private files.

makeExistingFilesAndDbsAccessible

open fun 
        makeExistingFilesAndDbsAccessible
(): Unit

Deprecated:

This class was deprecated in API level 21.

Makes accessible all files and databases whose names match the filePrefix that was passed to the constructor. Normally only files and databases that were created through this context are accessible.

openFileOutput

open fun 
        openFileOutput
(name: String!, mode: Int): FileOutputStream!

Deprecated:

This class was deprecated in API level 21.

Open a private file associated with this Context's application package for writing. Creates the file if it doesn't already exist.

No additional permissions are required for the calling app to read or write the returned file.

Parameters
name String!: The name of the file to open; can not contain path separators.
mode String!: Operating mode. Value is either 0 or a combination of android.content.Context#MODE_PRIVATE, android.content.Context#MODE_WORLD_READABLE, android.content.Context#MODE_WORLD_WRITEABLE, and android.content.Context#MODE_APPEND
Return
FileOutputStream!: The resulting FileOutputStream.

getDatabasePrefix

open fun 
        getDatabasePrefix
(): String!

Deprecated:

This class was deprecated in API level 21.

getCacheDir

open fun 
        getCacheDir
(): File!

Deprecated:

This class was deprecated in API level 21.

In order to support calls to getCacheDir(), we create a temp cache dir (inside the real one) and return it instead. This code is basically getCacheDir(), except it uses the real cache dir as the parent directory and creates a test cache dir inside that.

Return
File!: The path of the directory holding application cache files.

openOrCreateDatabase

open fun 
        openOrCreateDatabase
(name: String!, mode: Int, factory: SQLiteDatabase.CursorFactory!): SQLiteDatabase!

Deprecated:

This class was deprecated in API level 21.

Open a new private SQLiteDatabase associated with this Context's application package. Create the database file if it doesn't exist.

Parameters
name String!: The name (unique in the application package) of the database.
mode String!: Operating mode. Value is either 0 or a combination of android.content.Context#MODE_PRIVATE, android.content.Context#MODE_WORLD_READABLE, android.content.Context#MODE_WORLD_WRITEABLE, android.content.Context#MODE_ENABLE_WRITE_AHEAD_LOGGING, and android.content.Context#MODE_NO_LOCALIZED_COLLATORS
factory String!: An optional factory class that is called to instantiate a cursor when query is called.
Return
SQLiteDatabase!: The contents of a newly created database with the given name.
Exceptions
android.database.sqlite.SQLiteException if the database file could not be opened.

openOrCreateDatabase

added in API level 11
open fun 
        openOrCreateDatabase
(name: String!, mode: Int, factory: SQLiteDatabase.CursorFactory!, errorHandler: DatabaseErrorHandler?): SQLiteDatabase!

Deprecated:

This class was deprecated in API level 21.

Open a new private SQLiteDatabase associated with this Context's application package. Creates the database file if it doesn't exist.

Accepts input param: a concrete instance of DatabaseErrorHandler to be used to handle corruption when sqlite reports database corruption.


Requires API level 11 (Android 3.0, Honeycomb) Requires API level 11 (Android 3.0, Honeycomb) Requires API level 11 (Android 3.0, Honeycomb)
Parameters
name String!: The name (unique in the application package) of the database.
mode String!: Operating mode. Value is either 0 or a combination of android.content.Context#MODE_PRIVATE, android.content.Context#MODE_WORLD_READABLE, android.content.Context#MODE_WORLD_WRITEABLE, android.content.Context#MODE_ENABLE_WRITE_AHEAD_LOGGING, and android.content.Context#MODE_NO_LOCALIZED_COLLATORS
factory String!: An optional factory class that is called to instantiate a cursor when query is called.
errorHandler String!: the DatabaseErrorHandler to be used when sqlite reports database corruption. if null, android.database.DefaultDatabaseErrorHandler is assumed. This value may be null.
Return
SQLiteDatabase!: The contents of a newly created database with the given name.
Exceptions
android.database.sqlite.SQLiteException if the database file could not be opened.

deleteFile

open fun 
        deleteFile
(name: String!): Boolean

Deprecated:

This class was deprecated in API level 21.

Delete the given private file associated with this Context's application package.

Parameters
name String!: The name of the file to delete; can not contain path separators.
Return
Boolean: true if the file was successfully deleted; else false.

databaseList

open fun 
        databaseList
(): Array<String!>!

Deprecated:

This class was deprecated in API level 21.

Returns an array of strings naming the private databases associated with this Context's application package.

Return
Array<String!>!: Array of strings naming the private databases.

providerWithRenamedContext

open static fun <T : ContentProvider!> 
        providerWithRenamedContext
(contentProvider: Class<T>!, c: Context!, filePrefix: String!): T

Deprecated:

This class was deprecated in API level 21.

providerWithRenamedContext

open static fun <T : ContentProvider!> 
        providerWithRenamedContext
(contentProvider: Class<T>!, c: Context!, filePrefix: String!, allowAccessToExistingFilesAndDbs: Boolean): T

Deprecated:

This class was deprecated in API level 21.