Android Guides | Samples

Java.Lang.String.GetBytes Method

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

Syntax

[Android.Runtime.Register("getBytes", "(Ljava/lang/String;)[B", "")]
public Byte[] GetBytes (String encoding)

Parameters

charsetName

Exceptions

TypeReason
UnsupportedEncodingExceptionif the charset is not supported

Remarks

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

The behavior when this string cannot be represented in the named charset is unspecified. 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 1