Language

JavaPrimitiveArray<T> Class

Definition

Provides managed copying and native buffer access for a Java primitive array.

[Java.Interop.JniTypeSignature("java/lang/Object", ArrayRank=1, GenerateJavaPeer=false)]
public abstract class JavaPrimitiveArray<T> : Java.Interop.JavaArray<T>
[<Java.Interop.JniTypeSignature("java/lang/Object", ArrayRank=1, GenerateJavaPeer=false)>]
type JavaPrimitiveArray<'T> = class
    inherit JavaArray<'T>

Type Parameters

T

The managed type corresponding to the Java primitive elements.

Inheritance
JavaPrimitiveArray<T>
Derived
Attributes

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

Name Description
IsReadOnly

Gets whether array element values are read-only.

(Inherited from JavaArray<T>)
Item[Int32]

Gets or sets one primitive element by copying between Java and managed memory.

JniIdentityHashCode

Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode().

(Inherited from JavaObject)
JniManagedPeerState

Gets the state flags last assigned by the runtime.

(Inherited from JavaObject)
JniPeerMembers

Gets the member-access information for this managed Java peer.

(Inherited from JavaObject)
Length

Gets the number of elements in the Java array.

(Inherited from JavaArray<T>)
PeerReference

Gets the JNI reference currently stored in the peer control block.

(Inherited from JavaObject)

Methods

Name Description
Clear()

Clears element values without changing the array length.

(Inherited from JavaArray<T>)
Construct(JniObjectReference, JniObjectReferenceOptions)

Delegates construction of this peer to the runtime's value manager.

(Inherited from JavaObject)
Contains(T)

Tests whether the typed index search finds an element.

(Inherited from JavaArray<T>)
CopyFrom(T[], Int32, Int32, Int32)

Copies a range from managed memory into the Java primitive array.

CopyTo(Int32, T[], Int32, Int32)

Copies a range from the Java primitive array into managed memory.

CopyTo(T[], Int32)

Copies the complete Java array into a managed array.

CreateElements()

Acquires the array-specific native element-buffer wrapper.

Dispose()

Delegates peer disposal to the runtime's value manager.

(Inherited from JavaObject)
Dispose(Boolean)

Provides a derived-class cleanup hook; the base implementation does nothing.

(Inherited from JavaObject)
DisposeUnlessReferenced()

Disposes temporary marshaling arrays immediately; otherwise, uses the peer disposal policy.

Equals(Object)

Tests whether another managed peer refers to the same Java object.

(Inherited from JavaObject)
GetElements()

Acquires a native element-buffer wrapper through the derived implementation.

GetEnumerator()

Enumerates the array elements in index order.

(Inherited from JavaArray<T>)
GetHashCode()

Returns a hash code value for the object.

(Inherited from JavaObject)
IndexOf(T)

Finds the first matching element using the array implementation's comparison.

(Inherited from JavaArray<T>)
SetPeerReference(JniObjectReference, JniObjectReferenceOptions)

Stores a reference value in the control block without creating a JNI reference copy.

(Inherited from JavaObject)
ToArray()

Copies all elements into a new managed array.

(Inherited from JavaArray<T>)
ToString()

Returns a string representation of the object.

(Inherited from JavaObject)
UnregisterFromRuntime()

Removes this managed peer from the runtime mapping without disposing its JNI reference.

(Inherited from JavaObject)

Explicit Interface Implementations

Name Description
ICollection.CopyTo(Array, Int32)

Copies the Java array elements into an existing managed array.

(Inherited from JavaArray<T>)
ICollection.Count

Gets the array element count through the non-generic collection interface.

(Inherited from JavaArray<T>)
ICollection.IsSynchronized

Gets whether collection access is synchronized.

(Inherited from JavaArray<T>)
ICollection.SyncRoot

Gets the object supplied for external collection synchronization.

(Inherited from JavaArray<T>)
ICollection<T>.Add(T)

Always throws NotSupportedException because the Java array cannot grow.

(Inherited from JavaArray<T>)
ICollection<T>.Count

Gets the array element count through the generic collection interface.

(Inherited from JavaArray<T>)
ICollection<T>.Remove(T)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)
IEnumerable.GetEnumerator()

Gets the non-generic view of the typed enumerator.

(Inherited from JavaArray<T>)
IJavaPeerable.Disposed()

Marks this peer as disposed and calls Dispose with disposing set to true.

(Inherited from JavaObject)
IJavaPeerable.Finalized()

Marks this peer as disposed and calls Dispose with disposing set to false.

(Inherited from JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock

Gets the native control-block pointer used by this peer.

(Inherited from JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32)

Stores the identity hash code supplied by the runtime.

(Inherited from JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

Replaces the stored managed peer state flags.

(Inherited from JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference)

Updates the peer reference and releases a disposed peer's control block when the reference is invalid.

(Inherited from JavaObject)
IList.Add(Object)

Always throws NotSupportedException because the Java array cannot grow.

(Inherited from JavaArray<T>)
IList.Contains(Object)

Searches only values compatible with the managed element type.

(Inherited from JavaArray<T>)
IList.IndexOf(Object)

Searches for an object compatible with the managed element type.

(Inherited from JavaArray<T>)
IList.Insert(Int32, Object)

Always throws NotSupportedException because insertion cannot resize the Java array.

(Inherited from JavaArray<T>)
IList.IsFixedSize

Gets whether the Java array has a fixed length.

(Inherited from JavaArray<T>)
IList.Item[Int32]

Gets or sets an element through the non-generic list interface.

(Inherited from JavaArray<T>)
IList.Remove(Object)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)
IList.RemoveAt(Int32)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)
IList<T>.Insert(Int32, T)

Always throws NotSupportedException because insertion cannot resize the Java array.

(Inherited from JavaArray<T>)
IList<T>.RemoveAt(Int32)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

ToInteroperableCollection<T>(ICollection<T>)
Obsolete.

Reuses an existing typed JavaCollection or creates one from the supplied collection.

ToInteroperableCollection<T>(IList<T>)
Obsolete.

Reuses an existing typed JavaList or creates one from the supplied list.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to