SQLiteClosable | API reference | Android Developers (original) (raw)
abstract class SQLiteClosable : Closeable
An object created from a SQLiteDatabase that can be closed. This class implements a primitive reference counting scheme for database objects.
Summary
Public constructors |
---|
SQLiteClosable() |
Public methods | |
---|---|
open Unit | acquireReference() Acquires a reference to the object. |
open Unit | close() Releases a reference to the object, closing the object if the last reference was released. |
open Unit | releaseReference() Releases a reference to the object, closing the object if the last reference was released. |
open Unit | releaseReferenceFromContainer() Releases a reference to the object that was owned by the container of the object, closing the object if the last reference was released. |
Protected methods | |
---|---|
abstract Unit | onAllReferencesReleased() Called when the last reference to the object was released by a call to releaseReference() or #close(). |
open Unit | onAllReferencesReleasedFromContainer() Called when the last reference to the object was released by a call to releaseReferenceFromContainer(). |
Public constructors
SQLiteClosable
SQLiteClosable()
Public methods
acquireReference
open fun acquireReference(): Unit
Acquires a reference to the object.
Exceptions | |
---|---|
java.lang.IllegalStateException | if the last reference to the object has already been released. |
close
open fun close(): Unit
Releases a reference to the object, closing the object if the last reference was released. Calling this method is equivalent to calling [releaseReference](#releaseReference%28%29)
.
Exceptions | |
---|---|
java.lang.Exception | if this resource cannot be closed |
java.io.IOException | if an I/O error occurs |
releaseReference
open fun releaseReference(): Unit
Releases a reference to the object, closing the object if the last reference was released.
releaseReferenceFromContainer
open fun releaseReferenceFromContainer(): Unit
Deprecated: Do not use.
Releases a reference to the object that was owned by the container of the object, closing the object if the last reference was released.
Protected methods
onAllReferencesReleased
protected abstract fun onAllReferencesReleased(): Unit
Called when the last reference to the object was released by a call to [releaseReference()](#releaseReference%28%29)
or #close().
onAllReferencesReleasedFromContainer
protected open fun onAllReferencesReleasedFromContainer(): Unit
Deprecated: Do not use.
Called when the last reference to the object was released by a call to [releaseReferenceFromContainer()](#releaseReferenceFromContainer%28%29)
.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.