EAF 7.4 Implementation

com.lutris.util
Class Base64Encoder

java.lang.Object
  extended by com.lutris.util.Base64Encoder

public class Base64Encoder
extends java.lang.Object

Various conversion methods. These methods are mostly used to convert internal java data fields into byte arrays or strings for use over the network.

Author:
Mike Ward

Constructor Summary
Base64Encoder()
           
 
Method Summary
static byte[] fromBase64String(java.lang.String s)
          Performs RFC1521 style Base64 decoding of Base64 encoded data.
static java.lang.String toBase64SessionKeyString(byte[] bytes)
          The encoding is more or less Base 64, but instead of '+' and '/' as defined in RFC1521, the characters '_' and '-' are used because they are safe in URLs and file names.
static java.lang.String toBase64String(byte[] bytes)
          Performs RFC1521 style Base64 encoding of arbitrary binary data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64Encoder

public Base64Encoder()
Method Detail

toBase64String

public static final java.lang.String toBase64String(byte[] bytes)
Performs RFC1521 style Base64 encoding of arbitrary binary data. The output is a java String containing the Base64 characters representing the binary data. Be aware that this string is in Unicode form, and should be converted to UTF8 with the usual java conversion routines before it is sent over a network. The output string is guaranteed to only contain characters that are a single byte in UTF8 format. Also be aware that this routine leaves it to the caller to break the string into 70 byte lines as per RFC1521.

Parameters:
bytes - The array of bytes to convert to Base64 encoding.
Returns:
An string containing the specified bytes in Base64 encoded form.

toBase64SessionKeyString

public static final java.lang.String toBase64SessionKeyString(byte[] bytes)
The encoding is more or less Base 64, but instead of '+' and '/' as defined in RFC1521, the characters '_' and '-' are used because they are safe in URLs and file names.

Parameters:
bytes - The array of bytes to convert to Base64SessionKey encoding.
Returns:
An string containing the specified bytes in Base64 encoded form.

fromBase64String

public static final byte[] fromBase64String(java.lang.String s)
Performs RFC1521 style Base64 decoding of Base64 encoded data. The output is a byte array containing the decoded binary data. The input is expected to be a normal Unicode String object.

Parameters:
s - The Base64 encoded string to decode into binary data.
Returns:
An array of bytes containing the decoded data.

EAF 7.4 Implementation