|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.i2p.data.Base64
public class Base64
Encodes and decodes to and from Base64 notation.
Change Log:
I am placing this code in the Public Domain. Do with it as you will. This software comes with no guarantees or warranties but with plenty of well-wishing instead! Please visit http://iharder.net/xmlizable periodically to check for updates or to contribute improvements.
Modified by jrandom for i2p, using safeEncode / safeDecode to create filesystem and URL safe base64 values (replacing / with ~, and + with -)
| Method Summary | |
|---|---|
static byte[] |
decode(String s)
Decodes data from Base64 notation. |
static String |
decodeToString(String s)
Decodes data from Base64 notation and returns it as a string. |
static String |
encode(byte[] source)
|
static String |
encode(byte[] source,
boolean useStandardAlphabet)
|
static String |
encode(byte[] source,
int off,
int len)
|
static String |
encode(byte[] source,
int off,
int len,
boolean useStandardAlphabet)
|
static String |
encode(String source)
|
static void |
main(String[] args)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String encode(String source)
source - if null will return ""public static String encode(byte[] source)
source - if null will return ""
public static String encode(byte[] source,
int off,
int len)
source - if null will return ""
public static String encode(byte[] source,
boolean useStandardAlphabet)
source - if null will return ""useStandardAlphabet - Warning, must be false for I2P compatibility
public static String encode(byte[] source,
int off,
int len,
boolean useStandardAlphabet)
source - if null will return ""useStandardAlphabet - Warning, must be false for I2P compatibilitypublic static byte[] decode(String s)
s - Base 64 encoded string using the I2P alphabet A-Z, a-z, 0-9, -, ~
public static void main(String[] args)
public static String decodeToString(String s)
new String( decode( s ) )
WARNING this uses the locale's encoding, it may not be what you want.
s - the strind to decode
NPE - on error?
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||