Share via


Charset.Decode(ByteBuffer) Method

Definition

Convenience method that decodes bytes in this charset into Unicode characters.

[Android.Runtime.Register("decode", "(Ljava/nio/ByteBuffer;)Ljava/nio/CharBuffer;", "")]
public Java.Nio.CharBuffer? Decode (Java.Nio.ByteBuffer? bb);
[<Android.Runtime.Register("decode", "(Ljava/nio/ByteBuffer;)Ljava/nio/CharBuffer;", "")>]
member this.Decode : Java.Nio.ByteBuffer -> Java.Nio.CharBuffer

Parameters

bb
ByteBuffer

The byte buffer to be decoded

Returns

A char buffer containing the decoded characters

Attributes

Remarks

Convenience method that decodes bytes in this charset into Unicode characters.

An invocation of this method upon a charset cs returns the same result as the expression

cs.newDecoder()
                  .onMalformedInput(CodingErrorAction.REPLACE)
                  .onUnmappableCharacter(CodingErrorAction.REPLACE)
                  .decode(bb); 

except that it is potentially more efficient because it can cache decoders between successive invocations.

This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement byte array. In order to detect such sequences, use the CharsetDecoder#decode(java.nio.ByteBuffer) method directly.

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