Added in API level 26

ProxyFileDescriptorCallback


abstract class ProxyFileDescriptorCallback
kotlin.Any
   ↳ android.os.ProxyFileDescriptorCallback

Callback that handles file system requests from ProxyFileDescriptor. All callback methods except for onRelease should throw android.system.ErrnoException with proper errno on errors. See errno(3) and android.system.OsConstants. Typical errnos are

Summary

Public constructors

Public methods
open Unit

Ensures all the written data are stored in permanent storage device.

open Long

Returns size of bytes provided by the file descriptor.

open Int
onRead(offset: Long, size: Int, data: ByteArray!)

Provides bytes read from file descriptor.

abstract Unit

Invoked after the file is closed.

open Int
onWrite(offset: Long, size: Int, data: ByteArray!)

Handles bytes written to file descriptor.

Public constructors

ProxyFileDescriptorCallback

ProxyFileDescriptorCallback()

Public methods

onFsync

Added in API level 26
open fun onFsync(): Unit

Ensures all the written data are stored in permanent storage device. For example, if it has data stored in on memory cache, it needs to flush data to storage device.

Exceptions
android.system.ErrnoException ErrnoException containing E constants in OsConstants.

onGetSize

Added in API level 26
open fun onGetSize(): Long

Returns size of bytes provided by the file descriptor.

Return
Long Size of bytes.
Exceptions
android.system.ErrnoException ErrnoException containing E constants in OsConstants.

onRead

Added in API level 26
open fun onRead(
    offset: Long,
    size: Int,
    data: ByteArray!
): Int

Provides bytes read from file descriptor. It needs to return exact requested size of bytes unless it reaches file end.

Parameters
offset Long: Offset in bytes from the file head specifying where to read bytes. If a seek operation is conducted on the file descriptor, then a read operation is requested, the offset refrects the proper position of requested bytes.
size Int: Size for read bytes.
data ByteArray!: Byte array to store read bytes.
Return
Int Size of bytes returned by the function.
Exceptions
android.system.ErrnoException ErrnoException containing E constants in OsConstants.

onRelease

Added in API level 26
abstract fun onRelease(): Unit

Invoked after the file is closed.

onWrite

Added in API level 26
open fun onWrite(
    offset: Long,
    size: Int,
    data: ByteArray!
): Int

Handles bytes written to file descriptor.

Parameters
offset Long: Offset in bytes from the file head specifying where to write bytes. If a seek operation is conducted on the file descriptor, then a write operation is requested, the offset refrects the proper position of requested bytes.
size Int: Size for write bytes.
data ByteArray!: Byte array to be written to somewhere.
Return
Int Size of bytes processed by the function.
Exceptions
android.system.ErrnoException ErrnoException containing E constants in OsConstants.