Android Guides | Samples

Java.Lang.String.GetBytes Method

Returns a new byte array containing the code points of this string encoded using the given charset.

Syntax

[Android.Runtime.Register("getBytes", "(Ljava/nio/charset/Charset;)[B", "")]
public Byte[] GetBytes (Charset p0)

Parameters

charset

Remarks

Returns a new byte array containing the code points of this string encoded using the given charset.

The behavior when this string cannot be represented in the given charset is to replace malformed input and unmappable code points with the charset's default replacement byte array. Use CharsetEncoder 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