Click or drag to resize

JCOBridgeDirectBufferT Methods

The JCOBridgeDirectBufferT type exposes the following members.

Methods
 NameDescription
Public methodAsTNew Returns a new instance of JCOBridgeDirectBufferT
Public methodAsSpan Returns a zero-copy ReadOnlySpanT over the entire buffer, starting at offset zero regardless of the current position.
Public methodAsSpanFromIndex Returns a zero-copy ReadOnlySpanT over the buffer starting at the specified element index.
Public methodAsWritableSpan Returns a zero-copy writable SpanT over the entire buffer, starting at offset zero regardless of the current position.

Contract: if any element is modified through the returned span, FlushOnDispose MUST be called before Dispose to ensure changes are written back. Failing to do so results in silent data loss. For single or sparse writes prefer Write(...), which sets the flush flag automatically.

Public methodAsWritableSpanFromIndex Returns a zero-copy writable SpanT over the buffer starting at the specified element index.

Contract: if any element is modified through the returned span, FlushOnDispose MUST be called before Dispose to ensure changes are written back. Failing to do so results in silent data loss. For single or sparse writes prefer Write(...), which sets the flush flag automatically.

Public methodCopyTo(T, Int32) Copies the content of the buffer into destination.

On .NET 5+ and .NET Standard 2.1 dispatches to SIMD hardware intrinsics via AsSpan. On .NET Framework uses Buffer.MemoryCopy directly; if System.Memory is available in the AppDomain the SIMD path is activated automatically — see remarks on CopyTo(T, Int32) for loading instructions.

Public methodCopyTo(IntPtr, Int64, Int64, Int64) Fills the destination with a copy of the memory this JCOBridgeDirectBufferT instance is holding from the underlying ByteBuffer. The number of bytes actually copied may be less than length if the remaining bytes from startPosition to the buffer limit or destinationSize are smaller.
Public methodDisableCleanup Disable the internal object clean-up upon Dispose
Public methodDisableCleanupAndReturn Helper method to execute DisableCleanup and return the internal IJavaObject
Public methodDispose Execute Dispose activities releasing the underlying .NET memory pinned when the JCOBridgeDirectBufferT was requested
Public methodEnableCleanup Enable the internal object clean-up upon Dispose
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodFillWithArrayTArray Copies the content of array into memory managed from this JCOBridgeDirectBufferT instance
Protected methodFinalize Finalizer
(Overrides ObjectFinalize)
Public methodFlushOnDispose Marks this stream to flush all native memory changes back to the underlying resource on Dispose.

Must be called after any direct write performed through AsWritableSpan or AsWritableSpanFromIndex(Int32) before the stream is closed.

This method is idempotent — calling it multiple times has no additional effect.

Public methodGetEnumeratorReturns an enumerator that iterates through the collection.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetValue(Int32)Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32-bit integer.
Public methodGetValue(Int64)Gets the value at the specified position in the one-dimensional Array. The index is specified as a 64-bit integer.
Public methodInitializeInitializes every element of the value-type Array by calling the default constructor of the value type.
Public methodSetValue(T, Int32)Sets a value to the element at the specified position in the one-dimensional Array. The index is specified as a 32-bit integer.
Public methodSetValue(T, Int64)Sets a value to the element at the specified position in the one-dimensional Array. The index is specified as a 64-bit integer.
Public methodToArray(T, Boolean) Fills array with a reinterpreted copy of the memory this JCOBridgeDirectBufferT instance is holding. Use only when TArray differs from T; for same-type copies prefer CopyTo(T, Int32).
Public methodToArrayTArray Returns a TArray array which is the copy of the memory this JCOBridgeDirectBufferT instance is holding
Public methodToArrayTArray(TArray, Boolean) Fills array with a reinterpreted copy of the memory this JCOBridgeDirectBufferT instance is holding. Use only when TArray differs from T; for same-type copies prefer CopyTo(T, Int32).
Public methodToStream Converts this instance to a Stream can be used to manage directly the underlying memory without make intermediate array copy
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Extension Methods
 NameDescription
Public Extension MethodConvertTReturn Converts a generic object
(Defined by JCOBridgeExtensions)
Public Extension MethodToNative Converts a IJVMBridgeBase input to an object manageable from the JVM
(Defined by JCOBridgeExtensions)
Public Extension MethodToNative Converts a generic input to an object manageable from the JVM
(Defined by JCOBridgeExtensions)
Top
Explicit Interface Implementations
 NameDescription
Explicit interface implementationPrivate methodIEnumerableGetEnumeratorReturns an enumerator that iterates through a collection.
Top
See Also