Sdílet prostřednictvím


CharsetEncoder.Flush(ByteBuffer) Method

Definition

Flushes this encoder.

[Android.Runtime.Register("flush", "(Ljava/nio/ByteBuffer;)Ljava/nio/charset/CoderResult;", "")]
public Java.Nio.Charset.CoderResult? Flush (Java.Nio.ByteBuffer? out);
[<Android.Runtime.Register("flush", "(Ljava/nio/ByteBuffer;)Ljava/nio/charset/CoderResult;", "")>]
member this.Flush : Java.Nio.ByteBuffer -> Java.Nio.Charset.CoderResult

Parameters

out
ByteBuffer

The output byte buffer

Returns

A coder-result object, either CoderResult#UNDERFLOW or CoderResult#OVERFLOW

Attributes

Exceptions

if this encoder isn't already flushed or at end of input.

Remarks

Flushes this encoder.

Some encoders maintain internal state and may need to write some final bytes to the output buffer once the overall input sequence has been read.

Any additional output is written to the output buffer beginning at its current position. At most Buffer#remaining out.remaining() bytes will be written. The buffer's position will be advanced appropriately, but its mark and limit will not be modified.

If this method completes successfully then it returns CoderResult#UNDERFLOW. If there is insufficient room in the output buffer then it returns CoderResult#OVERFLOW. If this happens then this method must be invoked again, with an output buffer that has more room, in order to complete the current encoding operation.

If this encoder has already been flushed then invoking this method has no effect.

This method invokes the #implFlush implFlush method to perform the actual flushing operation.

Java documentation for java.nio.charset.CharsetEncoder.flush(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