Base64

expect object Base64 : Codec<Base64Data>

Base64

This class consists exclusively of static methods, optimized for each platform, for obtaining encoders and decoders for the Base64 encoding scheme. This implementation supports Base64 encodings as specified in RFC 4648 and RFC 2045.

This object defines the layout expected for each platform-specific implementation. Please see documentation for each implementation to understand how each fulfill this interface.

Basic Encoding

Uses "The Base64 Alphabet" as specified in Table 1 of RFC 4648 and RFC 2045 for encoding and decoding operation. The encoder does not add any line feed (line separator) character. The decoder rejects data that contains characters outside the base64 alphabet.

URL-safe Encoding

Uses the "URL and Filename safe Base64 Alphabet" as specified in Table 2 of RFC 4648 for encoding and decoding. The encoder does not add any line feed (line separator) character. The decoder rejects data that contains characters outside the base64 alphabet.

MIME

Uses "The Base64 Alphabet" as specified in Table 1 of RFC 2045 for encoding and decoding operation. The encoded output must be represented in lines of no more than 76 characters each and uses a carriage return '\r' followed immediately by a linefeed '\n' as the line separator. No line separator is added to the end of the encoded output.

All line separators or other characters not found in the base64 alphabet table are ignored in the decoding operation.

Unless otherwise noted, passing a null argument to a method of this class will cause a NullPointerException to be thrown.

Author

Sam Gammon

actual object Base64 : Codec<Base64Data>

Base64: Native.

actual object Base64 : Codec<Base64Data>

Base64

This class consists exclusively of static methods for obtaining encoders and decoders for the Base64 encoding scheme. This implementation supports Base64 encodings as specified in RFC 4648 and RFC 2045.

Basic Encoding

Uses "The Base64 Alphabet" as specified in Table 1 of RFC 4648 and RFC 2045 for encoding and decoding operation. The encoder does not add any line feed (line separator) character. The decoder rejects data that contains characters outside the base64 alphabet.

URL-safe Encoding

Uses the "URL and Filename safe Base64 Alphabet" as specified in Table 2 of RFC 4648 for encoding and decoding. The encoder does not add any line feed (line separator) character. The decoder rejects data that contains characters outside the base64 alphabet.

MIME

Uses "The Base64 Alphabet" as specified in Table 1 of RFC 2045 for encoding and decoding operation. The encoded output must be represented in lines of no more than 76 characters each and uses a carriage return '\r' followed immediately by a linefeed '\n' as the line separator. No line separator is added to the end of the encoded output.

All line separators or other characters not found in the base64 alphabet table are ignored in the decoding operation.

Unless otherwise noted, passing a null argument to a method of this class will cause a NullPointerException to be thrown.

Author

Xueming Shen

Sam Gammon

actual object Base64 : Codec<Base64Data>

Base64: Native.

Types

Link copied to clipboard
expect class Decoder

This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

actual class Decoder

This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

actual class Decoder

This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

actual class Decoder

This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

Link copied to clipboard
expect class Encoder

This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

actual class Encoder

This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

actual class Encoder

This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

actual class Encoder

This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

Functions

Link copied to clipboard
expect open override fun decode(data: Base64Data): ByteArray

Decode the provided raw data from the encoding implemented by this encoder; return a raw ByteArray of the resulting data.

open fun decode(data: Base64Data): ByteArray

Decode the provided raw data from the encoding implemented by this encoder; return a raw ByteArray of the resulting data.

open fun decode(data: Base64Data): ByteArray

Decode the provided raw data from the encoding implemented by this encoder; return a raw ByteArray of the resulting data.

open fun decode(data: Base64Data): ByteArray

Decode the provided raw data from the encoding implemented by this encoder; return a raw ByteArray of the resulting data.

Link copied to clipboard
abstract fun decodeBytes(data: ByteArray): ByteArray

Decode the provided data from the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

open override fun decodeBytes(data: ByteArray): ByteArray

Decode the provided data from the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

open override fun decodeBytes(data: ByteArray): ByteArray

Decode the provided data from the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

open override fun decodeBytes(data: ByteArray): ByteArray

Decode the provided data from the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

Link copied to clipboard
expect open override fun decoder(): Decoder<Base64Data>

Provide an Encoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to encode data to the target encoding.

Provide an Encoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to encode data to the target encoding.

Provide an Encoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to encode data to the target encoding.

Provide an Encoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to encode data to the target encoding.

Link copied to clipboard
open fun decodeString(string: String): ByteArray

Decode the provided string using the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

open fun decodeString(string: String): ByteArray

Decode the provided string using the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

open fun decodeString(string: String): ByteArray

Decode the provided string using the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

open fun decodeString(string: String): ByteArray

Decode the provided string using the encoding implemented by this encoder; return a raw ByteArray of the resulting bytes.

Link copied to clipboard

Decode the provided data from the encoding implemented by this encoder; return a String representation of the resulting data.

open fun decodeToString(string: String): String

Decode the provided string from the encoding implemented by this encoder; return a String representation of the resulting data.

Decode the provided data from the encoding implemented by this encoder; return a String representation of the resulting data.

open fun decodeToString(string: String): String

Decode the provided string from the encoding implemented by this encoder; return a String representation of the resulting data.

Decode the provided data from the encoding implemented by this encoder; return a String representation of the resulting data.

open fun decodeToString(string: String): String

Decode the provided string from the encoding implemented by this encoder; return a String representation of the resulting data.

Decode the provided data from the encoding implemented by this encoder; return a String representation of the resulting data.

open fun decodeToString(string: String): String

Decode the provided string from the encoding implemented by this encoder; return a String representation of the resulting data.

Link copied to clipboard
abstract fun encode(data: ByteArray): Base64Data

Encoded the provided data using the encoding implemented by this encoder; the returned Raw instance is able to provide a resulting ByteArray or String.

open override fun encode(data: ByteArray): Base64Data

Encoded the provided data using the encoding implemented by this encoder; the returned Raw instance is able to provide a resulting ByteArray or String.

open override fun encode(data: ByteArray): Base64Data

Encoded the provided data using the encoding implemented by this encoder; the returned Raw instance is able to provide a resulting ByteArray or String.

open override fun encode(data: ByteArray): Base64Data

Encoded the provided data using the encoding implemented by this encoder; the returned Raw instance is able to provide a resulting ByteArray or String.

Link copied to clipboard

Encode the provided data using the encoding implemented by this encoder; return a ByteArray representation of the result.

Encode the provided data using the encoding implemented by this encoder; return a ByteArray representation of the result.

Encode the provided data using the encoding implemented by this encoder; return a ByteArray representation of the result.

Encode the provided data using the encoding implemented by this encoder; return a ByteArray representation of the result.

Link copied to clipboard
expect open override fun encoder(): Encoder<Base64Data>

Provide a Decoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to decode data from the subject encoding.

Provide a Decoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to decode data from the subject encoding.

Provide a Decoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to decode data from the subject encoding.

Provide a Decoder specialized to the format implemented by this Codec; the resulting object can only guarantee a capability to decode data from the subject encoding.

Link copied to clipboard
open fun encodeString(string: String): ByteArray

Encode the provided string data using the encoding implemented by this encoder; by default, the string will be interpreted using UTF-8 encoding, then encoded to the target encoding.

open fun encodeString(string: String): ByteArray

Encode the provided string data using the encoding implemented by this encoder; by default, the string will be interpreted using UTF-8 encoding, then encoded to the target encoding.

open fun encodeString(string: String): ByteArray

Encode the provided string data using the encoding implemented by this encoder; by default, the string will be interpreted using UTF-8 encoding, then encoded to the target encoding.

open fun encodeString(string: String): ByteArray

Encode the provided string data using the encoding implemented by this encoder; by default, the string will be interpreted using UTF-8 encoding, then encoded to the target encoding.

Link copied to clipboard

Encode the provided data to a string representation using the encoding implemented by this encoder.

open fun encodeToString(string: String): String

Encode the provided string to a string representation using the encoding implemented by this encoder; the string is interpreted using UTF-8 encoding.

Encode the provided data to a string representation using the encoding implemented by this encoder.

open fun encodeToString(string: String): String

Encode the provided string to a string representation using the encoding implemented by this encoder; the string is interpreted using UTF-8 encoding.

Encode the provided data to a string representation using the encoding implemented by this encoder.

open fun encodeToString(string: String): String

Encode the provided string to a string representation using the encoding implemented by this encoder; the string is interpreted using UTF-8 encoding.

Encode the provided data to a string representation using the encoding implemented by this encoder.

open fun encodeToString(string: String): String

Encode the provided string to a string representation using the encoding implemented by this encoder; the string is interpreted using UTF-8 encoding.

Link copied to clipboard
expect fun encodeWebSafe(data: ByteArray): ByteArray

Encode the provided data into a Base64-encoded set of bytes, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

expect fun encodeWebSafe(string: String): String

Encode the provided string into a Base64-encoded string, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

actual fun encodeWebSafe(data: ByteArray): ByteArray

Encode the provided data into a Base64-encoded set of bytes, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

actual fun encodeWebSafe(string: String): String

Encode the provided string into a Base64-encoded string, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

actual fun encodeWebSafe(data: ByteArray): ByteArray

Encode the provided data into a Base64-encoded set of bytes, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

actual fun encodeWebSafe(string: String): String

Encode the provided string into a Base64-encoded string, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

actual fun encodeWebSafe(data: ByteArray): ByteArray

Encode the provided data into a Base64-encoded set of bytes, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

actual fun encodeWebSafe(string: String): String

Encode the provided string into a Base64-encoded string, omitting characters which are unsafe for use on the web, including padding characters, which are not emitted.

Link copied to clipboard
expect open override fun encoding(): Encoding

Return the enumerated Encoding which is implemented by this Codec.

actual open override fun encoding(): Encoding

Return the enumerated Encoding which is implemented by this Codec.

actual open override fun encoding(): Encoding

Return the enumerated Encoding which is implemented by this Codec.

actual open override fun encoding(): Encoding

Return the enumerated Encoding which is implemented by this Codec.