net.proxy
Class BASE64Encoder
java.lang.Object
net.proxy.BASE64Encoder
public class BASE64Encoder
- extends java.lang.Object
Utility class to do Base64 encoding, as defined by RFC 2045,
section 6.8 (http://www.ietf.org/rfc/rfc2045.txt)
Uses the same class and function names as Sun's implementation from
sun.misc
Method Summary |
java.lang.String |
encode(byte[] data)
Encode an array of bytes using Base64 |
static void |
main(java.lang.String[] args)
Simple test method to make sure everything works correctly
Creates 100 randomly sized arrays of random bytes, encodes them,
decodes them, and checks to make sure the result matches the input |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BASE64Encoder
public BASE64Encoder()
encode
public java.lang.String encode(byte[] data)
- Encode an array of bytes using Base64
- Parameters:
data[]
- The bytes to be encoded
- Returns:
- A valid Base64 representation of the input
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Simple test method to make sure everything works correctly
Creates 100 randomly sized arrays of random bytes, encodes them,
decodes them, and checks to make sure the result matches the input
- Throws:
java.lang.Exception