Click or drag to resize

JCOBridgeStreamT Methods

The JCOBridgeStreamT type exposes the following members.

Methods
 NameDescription
Public methodAsSpan Returns a zero-copy ReadOnlySpanT over the entire stream contents, starting at offset zero regardless of the current Position.

Prefer this over IEnumerableT for bulk comparisons and copies: MemoryExtensions.SequenceEqual{T}(ReadOnlySpan{T}, ReadOnlySpan{T}) dispatches to SIMD hardware intrinsics with no allocations.

Public methodAsSpanFromPosition Returns a zero-copy ReadOnlySpanT over the stream contents starting at the current Position.
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(Boolean) 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 methodAsWritableSpanFromPosition 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(Boolean) 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 methodBeginReadBegins an asynchronous read operation. (Consider using ReadAsync(Byte, Int32, Int32) instead; see the Remarks section.)
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodBeginWriteBegins an asynchronous write operation. (Consider using WriteAsync(Byte, Int32, Int32) instead; see the Remarks section.)
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodCloseCloses the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.
(Inherited from Stream)
Public methodCopyTo(Stream)Reads the bytes from the current stream and writes them to another stream.
(Inherited from Stream)
Public methodCopyTo(T, Int32) Copies all elements into destination starting at destinationIndex.

On .NET 5+ and .NET Standard 2.1 this operation is backed by ReadOnlySpanT and dispatches to SIMD hardware intrinsics with no intermediate allocation. On .NET Framework the copy is performed via MemoryCopy(Void*, Void*, Int64, Int64), which uses the OS-level memcpy implementation and is SIMD-accelerated on all supported platforms without requiring any additional dependency. In both cases no intermediate managed allocation occurs.

Public methodCopyTo(Stream, Int32)Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.
(Inherited from Stream)
Public methodCopyToAsync(Stream)Asynchronously reads the bytes from the current stream and writes them to another stream.
(Inherited from Stream)
Public methodCopyToAsync(Stream, Int32)Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size.
(Inherited from Stream)
Public methodCopyToAsync(Stream, Int32, CancellationToken)Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject)
Protected methodCreateWaitHandleAllocates a WaitHandle object.
(Inherited from Stream)
Obsolete
Public methodDisposeReleases all resources used by the Stream.
(Inherited from Stream)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
(Overrides JCOBridgeUnmanagedMemoryStreamDispose(Boolean))
Public methodEndReadWaits for the pending asynchronous read to complete. (Consider using ReadAsync(Byte, Int32, Int32) instead; see the Remarks section.)
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodEndWriteEnds an asynchronous write operation. (Consider using WriteAsync(Byte, Int32, Int32) instead; see the Remarks section.)
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalize Finalizer
(Overrides JCOBridgeUnmanagedMemoryStreamFinalize)
Public methodFlushWhen overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodFlushAsyncAsynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.
(Inherited from Stream)
Public methodFlushAsync(CancellationToken)Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodFlushOnDispose Marks this stream to flush all native memory changes back to the underlying resource on Dispose(Boolean).

Must be called after any direct write performed through AsWritableSpan or AsWritableSpanFromPosition 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 methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject)
Protected methodObjectInvariantProvides support for a Contract.
(Inherited from Stream)
Obsolete
Public methodReadWhen overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodReadAsync(Byte, Int32, Int32)Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
(Inherited from Stream)
Public methodReadAsync(Byte, Int32, Int32, CancellationToken)Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodReadByteReads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodSeekWhen overridden in a derived class, sets the position within the current stream.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodSetLengthWhen overridden in a derived class, sets the length of the current stream.
(Inherited from JCOBridgeUnmanagedMemoryStream)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodWriteWhen overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
(Overrides JCOBridgeUnmanagedMemoryStreamWrite(Byte, Int32, Int32))
Public methodWriteAsync(Byte, Int32, Int32)Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
(Inherited from Stream)
Public methodWriteAsync(Byte, Int32, Int32, CancellationToken)Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.
(Overrides JCOBridgeUnmanagedMemoryStreamWriteAsync(Byte, Int32, Int32, CancellationToken))
Public methodWriteByteWrites a byte to the current position in the stream and advances the position within the stream by one byte.
(Overrides JCOBridgeUnmanagedMemoryStreamWriteByte(Byte))
Top
Extension Methods
 NameDescription
Public Extension MethodConvertTReturn Converts a generic object
(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