|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.security.Base64Encoder
public final class Base64Encoder
BASE64 encoder implementation. Provides encoding methods, using the BASE64 encoding rules, as defined in the MIME specification, rfc1521. This class is a modified version based on code obtained from the w3 consortium website, which is subject to their generic copyright notice:
Constructor Summary | |
---|---|
Base64Encoder()
|
Method Summary | |
---|---|
static String |
encode(byte[] bytes)
Encode the given byte array and return the result as a string. |
static void |
encode(byte[] input,
OutputStream out)
Encode the supplied byte array and write the encoded data to the OutputStream out. |
static void |
encode(InputStream in,
OutputStream out)
Encodes data from supplied input to output. |
static String |
encode(String input)
Encode the given string,and return the encoded version as a string. |
static void |
main(String[] args)
Run with one argument, prints the encoded version of it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Base64Encoder()
Method Detail |
---|
public static void encode(InputStream in, OutputStream out) throws IOException
in
- The input stream to be encoded.out
- The output stream, to write encoded data to.
IOException
public static void encode(byte[] input, OutputStream out) throws IOException
IOException
public static String encode(String input) throws IOException
IOException
public static String encode(byte[] bytes) throws IOException
IOException
public static void main(String[] args) throws Exception
Alternatively, use the openssl utility, for example:
echo -n "password" | openssl dgst -sha1 -binary | openssl base64
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |