Share via


CharsetEncoder.EncodeLoop(CharBuffer, ByteBuffer) Method

Definition

Encodes one or more characters into one or more bytes.

[Android.Runtime.Register("encodeLoop", "(Ljava/nio/CharBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/charset/CoderResult;", "GetEncodeLoop_Ljava_nio_CharBuffer_Ljava_nio_ByteBuffer_Handler")]
protected abstract Java.Nio.Charset.CoderResult? EncodeLoop (Java.Nio.CharBuffer? in, Java.Nio.ByteBuffer? out);
[<Android.Runtime.Register("encodeLoop", "(Ljava/nio/CharBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/charset/CoderResult;", "GetEncodeLoop_Ljava_nio_CharBuffer_Ljava_nio_ByteBuffer_Handler")>]
abstract member EncodeLoop : Java.Nio.CharBuffer * Java.Nio.ByteBuffer -> Java.Nio.Charset.CoderResult

Parameters

in
CharBuffer

The input character buffer

out
ByteBuffer

The output byte buffer

Returns

A coder-result object describing the reason for termination

Attributes

Remarks

Encodes one or more characters into one or more bytes.

This method encapsulates the basic encoding loop, encoding as many characters as possible until it either runs out of input, runs out of room in the output buffer, or encounters an encoding error. This method is invoked by the #encode encode method, which handles result interpretation and error recovery.

The buffers are read from, and written to, starting at their current positions. At most Buffer#remaining in.remaining() characters will be read, and at most Buffer#remaining out.remaining() bytes will be written. The buffers' positions will be advanced to reflect the characters read and the bytes written, but their marks and limits will not be modified.

This method returns a CoderResult object to describe its reason for termination, in the same manner as the #encode encode method. Most implementations of this method will handle encoding errors by returning an appropriate result object for interpretation by the #encode encode method. An optimized implementation may instead examine the relevant error action and implement that action itself.

An implementation of this method may perform arbitrary lookahead by returning CoderResult#UNDERFLOW until it receives sufficient input.

Java documentation for java.nio.charset.CharsetEncoder.encodeLoop(java.nio.CharBuffer, java.nio.ByteBuffer).

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.

Applies to