com.hazelcast.util
Class Base64

java.lang.Object
  extended by com.hazelcast.util.Base64

public final class Base64
extends Object

This class provides encode/decode for RFC 2045 Base64 as defined by RFC 2045, N. Freed and N. Borenstein. RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies. Reference 1996 Available at: http://www.ietf.org/rfc/rfc2045.txt This class is used by XML Schema binary format validation

This implementation does not encode/decode streaming data. You need the data that you will encode/decode already on a byte arrray.

Version:
$Id$
Author:
Jeffrey Rodriguez, Sandy Gao

Method Summary
static byte[] decode(byte[] base64Data)
          Decodes Base64 data into octects
static byte[] encode(byte[] binaryData)
          Encodes hex octects into Base64
static int getDecodedDataLength(byte[] base64Data)
          returns length of decoded data given an array containing encoded data.
static boolean isArrayByteBase64(byte[] arrayOctect)
           
static boolean isBase64(byte octect)
           
static boolean isBase64(String isValidString)
           
protected static boolean isData(byte octect)
           
protected static boolean isPad(byte octect)
           
protected static boolean isWhiteSpace(byte octect)
           
static byte[] removeWhiteSpace(byte[] data)
          remove WhiteSpace from MIME containing encoded Base64 data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWhiteSpace

protected static boolean isWhiteSpace(byte octect)

isPad

protected static boolean isPad(byte octect)

isData

protected static boolean isData(byte octect)

isBase64

public static boolean isBase64(String isValidString)

isBase64

public static boolean isBase64(byte octect)

removeWhiteSpace

public static byte[] removeWhiteSpace(byte[] data)
remove WhiteSpace from MIME containing encoded Base64 data. e.g. " sdffferererrereresfsdfsdfsdff\n\r iiiiiiiiierejrlkwjerklwjerwerwr==\n\r"

Parameters:
data -
Returns:

isArrayByteBase64

public static boolean isArrayByteBase64(byte[] arrayOctect)

encode

public static byte[] encode(byte[] binaryData)
Encodes hex octects into Base64

Parameters:
binaryData - Array containing binaryData
Returns:
Encoded Base64 array

decode

public static byte[] decode(byte[] base64Data)
Decodes Base64 data into octects

Parameters:
base64Data - Byte array containing Base64 data
Returns:
Array containind decoded data.

getDecodedDataLength

public static int getDecodedDataLength(byte[] base64Data)
returns length of decoded data given an array containing encoded data. WhiteSpace removing is done if data array not valid.

Parameters:
base64Data -
Returns:
a -1 would be return if not


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.