Share via


Base64.Encoder.EncodeToString(Byte[]) Method

Definition

Encodes the specified byte array into a String using the Base64 encoding scheme.

[Android.Runtime.Register("encodeToString", "([B)Ljava/lang/String;", "GetEncodeToString_arrayBHandler", ApiSince=26)]
public virtual string EncodeToString (byte[] src);
[<Android.Runtime.Register("encodeToString", "([B)Ljava/lang/String;", "GetEncodeToString_arrayBHandler", ApiSince=26)>]
abstract member EncodeToString : byte[] -> string
override this.EncodeToString : byte[] -> string

Parameters

src
Byte[]

the byte array to encode

Returns

A String containing the resulting Base64 encoded characters

Attributes

Remarks

Encodes the specified byte array into a String using the Base64 encoding scheme.

This method first encodes all input bytes into a base64 encoded byte array and then constructs a new String by using the encoded byte array and the java.nio.charset.StandardCharsets#ISO_8859_1 ISO-8859-1 charset.

In other words, an invocation of this method has exactly the same effect as invoking new String(encode(src), StandardCharsets.ISO_8859_1).

Java documentation for java.util.Base64.Encoder.encodeToString(byte[]).

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