jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
Base codecs, i.e. More...
Classes | |
class | Alphabet |
Base Alphabet Specification providing the alphabet for encode() and decode(). More... | |
class | Ascii38Alphabet |
Safe base 38 alphabet with ASCII code-point sorting order. More... | |
class | Ascii64Alphabet |
Safe base 64 alphabet with ASCII code-point sorting order. More... | |
class | Ascii86Alphabet |
Base 86 alphabet with ASCII code-point sorting order. More... | |
class | Base64Alphabet |
Safe canonical base64 alphabet, without ASCII code-point sorting order. More... | |
class | Base64urlAlphabet |
Safe canonical base64url alphabet, without ASCII code-point sorting order. More... | |
class | Natural64Alphabet |
Safe natural base 64 alphabet, both without ASCII code-point sorting order. More... | |
class | Natural86Alphabet |
Natural base 86 alphabet, without ASCII code-point sorting order. More... | |
Static Public Member Functions | |
static String | encode (int num, final Alphabet aspec, final int min_width) |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base. More... | |
static String | encode (long num, final Alphabet aspec, final int min_width) |
Encodes a given positive decimal number to a symbolic string representing given alphabet and its base. More... | |
static String | encode (final int num, final Alphabet aspec) |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base. More... | |
static String | encode (final long num, final Alphabet aspec) |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base. More... | |
static long | decode (final String str, final Alphabet aspec) |
Decodes a given symbolic string representing a given alphabet and its base to a positive decimal number. More... | |
static StringBuilder | encode64 (final byte[] in_octets, int in_pos, int in_len, final Alphabet aspec) |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64 RFC 4648. More... | |
static ByteBuffer | decode64 (final String in_code, final Alphabet aspec) |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64 RFC 4648. More... | |
static int | insert_lf (final StringBuilder str, final int period) |
Inserts a line feed (LF) character \n (ASCII 0x0a) after every period of characters. More... | |
static int | remove_lf (final StringBuilder str) |
Removes line feed character from str. More... | |
static StringBuilder | encode64_pem (final byte[] in_octets, final int in_pos, final int in_len, final Alphabet aspec) |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64 RFC 4648 and adds line-feeds every 64 characters as required for PEM. More... | |
static StringBuilder | encode64_mime (final byte[] in_octets, final int in_pos, final int in_len, final Alphabet aspec) |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64 RFC 4648 and adds line-feeds every 76 characters as required for MIME. More... | |
static ByteBuffer | decode64_lf (final String str, final Alphabet aspec) |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64 RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME. More... | |
static ByteBuffer | decode64_lf (final StringBuilder str, final Alphabet aspec) |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64 RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME. More... | |
Base codecs, i.e.
changing the decimal or binary values' base for a different representation.
Definition at line 31 of file BaseCodec.java.
|
static |
Decodes a given symbolic string representing a given alphabet and its base to a positive decimal number.
Besides using a custom alphabet, the following build-in alphabets are provided
BaseCodec.Base64Alphabet
BaseCodec.Base64urlAlphabet
BaseCodec.Natural86Alphabet
BaseCodec.Ascii64Alphabet
BaseCodec.Ascii86Alphabet
str | an encoded string |
aspec | the used alphabet specification |
Definition at line 573 of file BaseCodec.java.
|
static |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64
RFC 4648.
An error only occurs if the encoded string length > 0 and resulting decoded octets size is empty.
in_code | encoded string |
aspec | the used base 64 alphabet specification |
Definition at line 663 of file BaseCodec.java.
|
static |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64
RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME.
An error only occurs if the encoded string length > 0 and resulting decoded octets size is empty.
str | and encoded string, will be copied |
aspec | the used base 64 alphabet specification |
Definition at line 814 of file BaseCodec.java.
|
static |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64
RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME.
An error only occurs if the encoded string length > 0 and resulting decoded octets size is empty.
str | and encoded string, no copy, will be mutated |
aspec | the used base 64 alphabet specification |
Definition at line 831 of file BaseCodec.java.
|
static |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base.
Besides using a custom alphabet, the following build-in alphabets are provided
BaseCodec.Base64Alphabet
BaseCodec.Base64urlAlphabet
BaseCodec.Natural86Alphabet
BaseCodec.Ascii64Alphabet
BaseCodec.Ascii86Alphabet
num | a positive decimal number |
aspec | the used alphabet specification |
Definition at line 531 of file BaseCodec.java.
|
static |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base.
Besides using a custom alphabet, the following build-in alphabets are provided
BaseCodec.Base64Alphabet
BaseCodec.Base64urlAlphabet
BaseCodec.Natural86Alphabet
BaseCodec.Ascii64Alphabet
BaseCodec.Ascii86Alphabet
num | a positive decimal number |
aspec | the used alphabet specification |
Definition at line 552 of file BaseCodec.java.
|
static |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base.
Besides using a custom alphabet, the following build-in alphabets are provided
BaseCodec.Base64Alphabet
BaseCodec.Base64urlAlphabet
BaseCodec.Natural86Alphabet
BaseCodec.Ascii64Alphabet
BaseCodec.Ascii86Alphabet
num | a positive decimal number |
aspec | the used alphabet specification |
min_width | minimum width of the encoded string, encoded zero is used for padding |
Definition at line 460 of file BaseCodec.java.
|
static |
Encodes a given positive decimal number to a symbolic string representing given alphabet and its base.
Besides using a custom alphabet, the following build-in alphabets are provided
BaseCodec.Base64Alphabet
BaseCodec.Base64urlAlphabet
BaseCodec.Natural86Alphabet
BaseCodec.Ascii64Alphabet
BaseCodec.Ascii86Alphabet
num | a positive decimal number |
aspec | the used alphabet specification |
min_width | minimum width of the encoded string, encoded zero is used for padding |
Definition at line 496 of file BaseCodec.java.
|
static |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64
RFC 4648.
An error only occurs if in_len > 0 and resulting encoded string is empty.
in_octets | source byte array |
in_pos | index to octets start |
in_len | length of octets in bytes |
aspec | the used base 64 alphabet specification |
Definition at line 604 of file BaseCodec.java.
|
static |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64
RFC 4648 and adds line-feeds every 76 characters as required for MIME.
An error only occurs if in_len > 0 and resulting encoded string is empty.
in_octets | pointer to octets start |
in_len | length of octets in bytes |
aspec | the used base 64 alphabet specification |
Definition at line 797 of file BaseCodec.java.
|
static |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64
RFC 4648 and adds line-feeds every 64 characters as required for PEM.
An error only occurs if in_len > 0 and resulting encoded string is empty.
in_octets | pointer to octets start |
in_len | length of octets in bytes |
aspec | the used alphabet specification |
Definition at line 779 of file BaseCodec.java.
|
static |
Inserts a line feed (LF) character \n
(ASCII 0x0a) after every period of characters.
str | the input string of characters, which will be mutated. |
period | period of characters after which one LF will be inserted. |
Definition at line 740 of file BaseCodec.java.
|
static |
Removes line feed character from str.
str | the input string of characters, which will be mutated. |
Definition at line 755 of file BaseCodec.java.