Base64.Encoder.Encode Method

Definition

Overloads

Encode(ByteBuffer)

Encodes all remaining bytes from the specified byte buffer into a newly-allocated ByteBuffer using the Base64 encoding scheme.

Encode(Byte[])

Encodes all bytes from the specified byte array into a newly-allocated byte array using the Base64 encoding scheme.

Encode(Byte[], Byte[])

Encodes all bytes from the specified byte array using the Base64 encoding scheme, writing the resulting bytes to the given output byte array, starting at offset 0.

Encode(ByteBuffer)

Encodes all remaining bytes from the specified byte buffer into a newly-allocated ByteBuffer using the Base64 encoding scheme.

[Android.Runtime.Register("encode", "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;", "GetEncode_Ljava_nio_ByteBuffer_Handler", ApiSince=26)]
public virtual Java.Nio.ByteBuffer Encode (Java.Nio.ByteBuffer buffer);
[<Android.Runtime.Register("encode", "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;", "GetEncode_Ljava_nio_ByteBuffer_Handler", ApiSince=26)>]
abstract member Encode : Java.Nio.ByteBuffer -> Java.Nio.ByteBuffer
override this.Encode : Java.Nio.ByteBuffer -> Java.Nio.ByteBuffer

Parameters

buffer
ByteBuffer

the source ByteBuffer to encode

Returns

A newly-allocated byte buffer containing the encoded bytes.

Attributes

Remarks

Encodes all remaining bytes from the specified byte buffer into a newly-allocated ByteBuffer using the Base64 encoding scheme.

Upon return, the source buffer's position will be updated to its limit; its limit will not have been changed. The returned output buffer's position will be zero and its limit will be the number of resulting encoded bytes.

Java documentation for java.util.Base64.Encoder.encode(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

Encode(Byte[])

Encodes all bytes from the specified byte array into a newly-allocated byte array using the Base64 encoding scheme.

[Android.Runtime.Register("encode", "([B)[B", "GetEncode_arrayBHandler", ApiSince=26)]
public virtual byte[] Encode (byte[] src);
[<Android.Runtime.Register("encode", "([B)[B", "GetEncode_arrayBHandler", ApiSince=26)>]
abstract member Encode : byte[] -> byte[]
override this.Encode : byte[] -> byte[]

Parameters

src
Byte[]

the byte array to encode

Returns

Byte[]

A newly-allocated byte array containing the resulting encoded bytes.

Attributes

Remarks

Encodes all bytes from the specified byte array into a newly-allocated byte array using the Base64 encoding scheme. The returned byte array is of the length of the resulting bytes.

Java documentation for java.util.Base64.Encoder.encode(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

Encode(Byte[], Byte[])

Encodes all bytes from the specified byte array using the Base64 encoding scheme, writing the resulting bytes to the given output byte array, starting at offset 0.

[Android.Runtime.Register("encode", "([B[B)I", "GetEncode_arrayBarrayBHandler", ApiSince=26)]
public virtual int Encode (byte[] src, byte[] dst);
[<Android.Runtime.Register("encode", "([B[B)I", "GetEncode_arrayBarrayBHandler", ApiSince=26)>]
abstract member Encode : byte[] * byte[] -> int
override this.Encode : byte[] * byte[] -> int

Parameters

src
Byte[]

the byte array to encode

dst
Byte[]

the output byte array

Returns

The number of bytes written to the output byte array

Attributes

Remarks

Encodes all bytes from the specified byte array using the Base64 encoding scheme, writing the resulting bytes to the given output byte array, starting at offset 0.

It is the responsibility of the invoker of this method to make sure the output byte array dst has enough space for encoding all bytes from the input byte array. No bytes will be written to the output byte array if the output byte array is not big enough.

Java documentation for java.util.Base64.Encoder.encode(byte[], 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