|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.crypto.internal.Convert
public final class Convert
Utility class for various string conversions, such as base64 encoding and decoding and conversion to byte array. Supports conversion of strings containing base64 encoded data. The conversion uses UTF-8 because it is always available and base64 alphabet is a subset of UTF-8.
| Method Summary | |
|---|---|
static java.lang.String |
bytesToString(byte[] bytes)
Convert byte array into a string using UTF-8 encoding. |
static byte[] |
fromBase64(byte[] base64Encoded)
Decode the base64 encoded data array. |
static byte[] |
fromBase64String(java.lang.String base64Encoded)
Decode the base64 encoded data represented as string. |
static byte[] |
fromBase64String(java.lang.String withBase64EncodedContent,
java.lang.String beginningMarker,
java.lang.String endMarker)
Decode the base64 encoded data represented as string. |
static java.lang.String |
getContentBetween(java.lang.String input,
java.lang.String beginningMarker,
java.lang.String endMarker)
Get substring between beginningMarker and endMarker. |
static java.lang.String |
getNewline()
|
static byte[] |
stringToBytes(java.lang.String string)
Convert string to byte array using the same encoding as for base64 conversion. |
static byte[] |
stringToBytes(java.lang.String withBase64EncodedContent,
java.lang.String beginningMarker,
java.lang.String endMarker)
Convert string to byte array using the same encoding as for base64 conversion. |
static byte[] |
toBase64(byte[] data)
Encode given data and return the base64 encoded result as a byte array. |
static java.lang.String |
toBase64String(byte[] data)
Encode given data and return the base64 encoded result as string (no line breaks). |
static java.lang.String |
toChunkedBase64String(byte[] data)
Encode given data and return the base64 encoded result as string, chunking it into several lines of the default length (64). |
static java.lang.String |
toChunkedBase64String(byte[] data,
int lineLength)
Encode given data and return the base64 encoded result as string, chunking it into several lines of the given length. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String toBase64String(byte[] data)
data - the data to encode
public static java.lang.String toChunkedBase64String(byte[] data)
data - the data to encode
public static java.lang.String toChunkedBase64String(byte[] data,
int lineLength)
data - the data to encodelineLength - maximal line length
public static byte[] toBase64(byte[] data)
data - the data to encode
public static byte[] fromBase64String(java.lang.String withBase64EncodedContent,
java.lang.String beginningMarker,
java.lang.String endMarker)
withBase64EncodedContent - string containing base64 encoded data.beginningMarker - anything in the string which is not after this will be ignored.endMarker - anything in the string which is not before this will be ignored.
public static byte[] fromBase64String(java.lang.String base64Encoded)
base64Encoded - base64 encoded data string
public static byte[] fromBase64(byte[] base64Encoded)
base64Encoded - base64 encoded data
public static java.lang.String getContentBetween(java.lang.String input,
java.lang.String beginningMarker,
java.lang.String endMarker)
input - string to get content from.beginningMarker - anything in the string which is not after this will be ignored.endMarker - anything in the string which is not before this will be ignored.
public static byte[] stringToBytes(java.lang.String withBase64EncodedContent,
java.lang.String beginningMarker,
java.lang.String endMarker)
withBase64EncodedContent - string containing base64 encoded data.beginningMarker - anything in the string which is not after this will be ignored.endMarker - anything in the string which is not before this will be ignored.
public static byte[] stringToBytes(java.lang.String string)
string - the string to convert
public static java.lang.String bytesToString(byte[] bytes)
bytes - to make into a string
public static java.lang.String getNewline()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||