Android Guides | Samples

Android.OS.MemoryFile Class

MemoryFile is a wrapper for the Linux ashmem driver.

See Also: MemoryFile

Syntax

[Android.Runtime.Register("android/os/MemoryFile", DoNotGenerateAcw=true)]
public class MemoryFile : Object

Remarks

MemoryFile is a wrapper for the Linux ashmem driver. MemoryFiles are backed by shared memory, which can be optionally set to be purgeable. Purgeable files may have their contents reclaimed by the kernel in low memory conditions (only if allowPurging is set to true). After a file is purged, attempts to read or write the file will cause an IOException to be thrown.

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.OS.MemoryFile are listed below.

See Also: Object

Public Constructors

Allocates a new ashmem region.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
InputStreamStream. Creates a new InputStream for reading from the memory file.
[read-only]
IsPurgingAllowedBoolean. Is memory file purging enabled?
[read-only]
OutputStreamStream. Creates a new OutputStream for writing to the memory file.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AllowPurging(Boolean) : Boolean
Enables or disables purging of the memory file.
Close()
Closes the memory file.
Length() : Int32
Returns the length of the memory file.
ReadBytes(Byte[], Int32, Int32, Int32) : Int32
Reads bytes from the memory file.
WriteBytes(Byte[], Int32, Int32, Int32)
Write bytes to the memory file.