Base64
class Base64
| kotlin.Any | |
| ↳ | java.util.Base64 |
This class consists exclusively of static methods for obtaining encoders and decoders for the Base64 encoding scheme. The implementation of this class supports the following types of Base64 as specified in RFC 4648 and RFC 2045.
- Basic
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 and Filename safe
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 decoding operation.
Unless otherwise noted, passing a null argument to a method of this class will cause a NullPointerException to be thrown.
Summary
| Nested classes | |
|---|---|
|
This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045. |
|
|
This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045. |
|
| Public methods | |
|---|---|
| static Base64.Decoder! |
Returns a |
| static Base64.Encoder! |
Returns a |
| static Base64.Decoder! |
Returns a |
| static Base64.Encoder! |
Returns a |
| static Base64.Encoder! |
getMimeEncoder(lineLength: Int, lineSeparator: ByteArray!)Returns a |
| static Base64.Decoder! |
Returns a |
| static Base64.Encoder! |
Returns a |
Public methods
getDecoder
static fun getDecoder(): Base64.Decoder!
Returns a Decoder that decodes using the Basic type base64 encoding scheme.
| Return | |
|---|---|
Base64.Decoder! |
A Base64 decoder. |
getEncoder
static fun getEncoder(): Base64.Encoder!
Returns a Encoder that encodes using the Basic type base64 encoding scheme.
| Return | |
|---|---|
Base64.Encoder! |
A Base64 encoder. |
getMimeDecoder
static fun getMimeDecoder(): Base64.Decoder!
Returns a Decoder that decodes using the MIME type base64 decoding scheme.
| Return | |
|---|---|
Base64.Decoder! |
A Base64 decoder. |
getMimeEncoder
static fun getMimeEncoder(): Base64.Encoder!
Returns a Encoder that encodes using the MIME type base64 encoding scheme.
| Return | |
|---|---|
Base64.Encoder! |
A Base64 encoder. |
getMimeEncoder
static fun getMimeEncoder(
lineLength: Int,
lineSeparator: ByteArray!
): Base64.Encoder!
Returns a Encoder that encodes using the MIME type base64 encoding scheme with specified line length and line separators.
| Parameters | |
|---|---|
lineLength |
Int: the length of each output line (rounded down to nearest multiple of 4). If the rounded down line length is not a positive value, the output will not be separated in lines |
lineSeparator |
ByteArray!: the line separator for each output line |
| Return | |
|---|---|
Base64.Encoder! |
A Base64 encoder. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if lineSeparator includes any character of "The Base64 Alphabet" as specified in Table 1 of RFC 2045. |
getUrlDecoder
static fun getUrlDecoder(): Base64.Decoder!
Returns a Decoder that decodes using the URL and Filename safe type base64 encoding scheme.
| Return | |
|---|---|
Base64.Decoder! |
A Base64 decoder. |
getUrlEncoder
static fun getUrlEncoder(): Base64.Encoder!
Returns a Encoder that encodes using the URL and Filename safe type base64 encoding scheme.
| Return | |
|---|---|
Base64.Encoder! |
A Base64 encoder. |