Android Guides | Samples

Java.Lang.String Constructor

Converts the byte array to a string using the given charset.

Syntax

[Android.Runtime.Register(".ctor", "([BIILjava/nio/charset/Charset;)V", "")]
public String (Byte[] p0, Int32 p1, Int32 p2, Charset p3)

Parameters

data
offset
byteCount
charset

Exceptions

TypeReason
IndexOutOfBoundsExceptionif byteCount data.length
NullPointerExceptionif data == null

Remarks

Converts the byte array to a string using the given charset.

The behavior when the bytes cannot be decoded by the given charset is to replace malformed input and unmappable code points with the charset's default replacement string. Use CharsetDecoder for more control.

[Android Documentation]

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 9