Java.Nio.Charset.CharsetDecoder.Decode Method
Decodes bytes starting at the current position of the given input buffer, and writes the equivalent character sequence into the given output buffer from its current position.

Syntax

[Android.Runtime.Register("decode", "(Ljava/nio/ByteBuffer;Ljava/nio/CharBuffer;Z)Ljava/nio/charset/CoderResult;", "")]
public CoderResult Decode (Java.Nio.ByteBuffer in, Java.Nio.CharBuffer out, bool endOfInput)

Parameters

in
the input buffer.
out
the output buffer.
endOfInput
true if all the input characters have been provided.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.IllegalStateExceptionif decoding has started or no more input is needed in this decoding progress.
Java.Nio.Charset.CoderMalfunctionErrorif the CharsetDecoder.DecodeLoop(Java.Nio.ByteBuffer, Java.Nio.CharBuffer) method threw an BufferUnderflowException or BufferOverflowException.

Remarks

Decodes bytes starting at the current position of the given input buffer, and writes the equivalent character sequence into the given output buffer from its current position.

The buffers' position will be changed with the reading and writing operation, but their limits and marks will be kept intact.

A CoderResult instance will be returned according to following rules:

  • CoderResult.Overflow indicates that even though not all of the input has been processed, the buffer the output is being written to has reached its capacity. In the event of this code being returned this method should be called once more with an out argument that has not already been filled.
  • CoderResult.Underflow indicates that as many bytes as possible in the input buffer have been decoded. If there is no further input and no remaining bytes in the input buffer then this operation may be regarded as complete. Otherwise, this method should be called once more with additional input.
  • A CoderResult.MalformedForLength(int) result indicates that some malformed input error has been encountered, and the erroneous bytes start at the input buffer's position and their number can be got by result's CoderResult.Length. This kind of result can be returned only if the malformed action is CodingErrorAction.Report.
  • A CoderResult.UnmappableForLength(int) result indicates that some unmappable character error has been encountered, and the erroneous bytes start at the input buffer's position and their number can be got by result's CoderResult.Length. This kind of result can be returned only if the unmappable character action is CodingErrorAction.Report.

The endOfInput parameter indicates that the invoker cannot provide further input. This parameter is true if and only if the bytes in current input buffer are all inputs for this decoding operation. Note that it is common and won't cause an error if the invoker sets false and then can't provide more input, while it may cause an error if the invoker always sets true in several consecutive invocations. This would make the remaining input to be treated as malformed input.

This method invokes the CharsetDecoder.DecodeLoop(Java.Nio.ByteBuffer, Java.Nio.CharBuffer) method to implement the basic decode logic for a specific charset.

[Android Documentation]

Requirements

Namespace: Java.Nio.Charset
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1