|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KCodecs
public class KCodecs
A wrapper class for the most commonly used encoding and decoding algorithms. Currently there is support for encoding and decoding input using base64, uu and the quoted-printable specifications. sage:
String input = "Aladdin:open sesame"; String result = KCodecs.base64Encode(input); cout << "Result: " << result.data() << endl;
Output should be Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ==The above example makes use of the convenience functions (ones that accept/return null-terminated strings) to encode/decode a string. If what you need is to encode or decode binary data, then it is highly recommended that you use the functions that take an input and output byte[] as arguments. These functions are specifically tailored for encoding and decoding binary data.
Constructor Summary | |
---|---|
protected |
KCodecs(java.lang.Class dummy)
|
Method Summary | |
---|---|
static java.lang.String |
base64Decode(byte[] in)
Decodes the given data that was encoded using the base64 algorithm. |
static void |
base64Decode(byte[] in,
byte[] out)
Decodes the given data that was encoded with the base64 algorithm. |
static java.lang.String |
base64Decode(java.lang.String str)
|
static java.lang.String |
base64Encode(byte[] in)
|
static java.lang.String |
base64Encode(byte[] in,
boolean insertLFs)
Encodes the given data using the base64 algorithm. |
static void |
base64Encode(byte[] in,
byte[] out)
|
static void |
base64Encode(byte[] in,
byte[] out,
boolean insertLFs)
Encodes the given data using the base64 algorithm. |
static java.lang.String |
base64Encode(java.lang.String str)
|
static java.lang.String |
base64Encode(java.lang.String str,
boolean insertLFs)
|
static java.lang.String |
quotedPrintableDecode(byte[] in)
Decodes a quoted-printable encoded data. |
static void |
quotedPrintableDecode(byte[] in,
byte[] out)
Decodes a quoted-printable encoded data. |
static java.lang.String |
quotedPrintableDecode(java.lang.String str)
|
static java.lang.String |
quotedPrintableEncode(byte[] in)
|
static java.lang.String |
quotedPrintableEncode(byte[] in,
boolean useCRLF)
Encodes the given data using the quoted-printable algorithm. |
static void |
quotedPrintableEncode(byte[] in,
byte[] out,
boolean useCRLF)
Encodes the given data using the quoted-printable algorithm. |
static java.lang.String |
quotedPrintableEncode(java.lang.String str)
|
static java.lang.String |
quotedPrintableEncode(java.lang.String str,
boolean useCRLF)
|
static java.lang.String |
uudecode(byte[] in)
Decodes the given data using the uudecode algorithm. |
static void |
uudecode(byte[] in,
byte[] out)
Decodes the given data using the uudecode algorithm. |
static java.lang.String |
uudecode(java.lang.String str)
|
static java.lang.String |
uuencode(byte[] in)
Encodes the given data using the uuencode algorithm. |
static void |
uuencode(byte[] in,
byte[] out)
Encodes the given data using the uuencode algorithm. |
static java.lang.String |
uuencode(java.lang.String str)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected KCodecs(java.lang.Class dummy)
Method Detail |
---|
public static java.lang.String quotedPrintableEncode(byte[] in, boolean useCRLF)
in
- data to be encoded.useCRLF
- if true the input data is expected to have
CRLF line breaks and the output will have CRLF line
breaks, too.
public static java.lang.String quotedPrintableEncode(byte[] in)
public static java.lang.String quotedPrintableEncode(java.lang.String str, boolean useCRLF)
str
- string to be encoded.useCRLF
- if true the input data is expected to have
CRLF line breaks and the output will have CRLF line
breaks, too.
public static java.lang.String quotedPrintableEncode(java.lang.String str)
public static void quotedPrintableEncode(byte[] in, byte[] out, boolean useCRLF)
in
- data to be encoded.out
- encoded data.useCRLF
- if true the input data is expected to have
CRLF line breaks and the output will have CRLF line
breaks, too.public static java.lang.String quotedPrintableDecode(byte[] in)
in
- data to be decoded.
public static java.lang.String quotedPrintableDecode(java.lang.String str)
str
- string to be decoded.
public static void quotedPrintableDecode(byte[] in, byte[] out)
in
- data to be decoded.out
- decoded data.public static java.lang.String uuencode(byte[] in)
in
- data to be uuencoded
public static java.lang.String uuencode(java.lang.String str)
str
- string to be uuencoded.
public static void uuencode(byte[] in, byte[] out)
in
- data to be uuencoded.out
- uudecoded data.public static java.lang.String uudecode(byte[] in)
in
- data to be decoded.
public static java.lang.String uudecode(java.lang.String str)
str
- string to be decoded.
public static void uudecode(byte[] in, byte[] out)
in
- data to be decoded.out
- uudecoded data.public static java.lang.String base64Encode(byte[] in, boolean insertLFs)
insertLFs
is true, then
there will be 76 characters or less per line.
in
- data to be encoded.insertLFs
- limit the number of characters per line.
public static java.lang.String base64Encode(byte[] in)
public static java.lang.String base64Encode(java.lang.String str, boolean insertLFs)
str
- string to be encoded.insertLFs
- limit the number of characters per line.
public static java.lang.String base64Encode(java.lang.String str)
public static void base64Encode(byte[] in, byte[] out, boolean insertLFs)
insertLFs
is true, then there will be 76
characters or less per line.
NOTE: the output array is first reset and then resized
appropriately before use, hence, all data stored in the
output array will be lost.
in
- data to be encoded.out
- encoded data.insertLFs
- limit the number of characters per line.public static void base64Encode(byte[] in, byte[] out)
public static java.lang.String base64Decode(byte[] in)
in
- data to be decoded.
public static java.lang.String base64Decode(java.lang.String str)
str
- string to be decoded.
public static void base64Decode(byte[] in, byte[] out)
in
- data to be decoded.out
- decoded data.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |