org.glassfish.jersey.internal.util
Class Base64

java.lang.Object
  extended by org.glassfish.jersey.internal.util.Base64

public class Base64
extends Object

Utility class that implements base64 encoding and decoding.

Author:
Martin Matula (martin.matula at oracle.com)

Constructor Summary
Base64()
           
 
Method Summary
static byte[] decode(byte[] buffer)
          Decodes Base64 data into octects.
static String decodeAsString(byte[] buffer)
          Decodes array of bytes using base64 decoding and returns the result as a string.
static String decodeAsString(String text)
          Decodes a string using base64 and returns the result as another string.
static byte[] encode(byte[] buffer)
          Encodes array of bytes using base64 encoding.
static String encodeAsString(byte[] buffer)
          Encodes array of bytes using base64 encoding and returns the result as a string.
static String encodeAsString(String text)
          Encodes a string using base64 and returns the result as another string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64

public Base64()
Method Detail

encode

public static byte[] encode(byte[] buffer)
Encodes array of bytes using base64 encoding.

Parameters:
buffer - Array of bytes to be encoded.
Returns:
Encoded result as an array of bytes.

decode

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

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

encodeAsString

public static String encodeAsString(byte[] buffer)
Encodes array of bytes using base64 encoding and returns the result as a string.

Parameters:
buffer - Array of bytes to be encoded.
Returns:
Resulting encoded string.

encodeAsString

public static String encodeAsString(String text)
Encodes a string using base64 and returns the result as another string.

Parameters:
text - String to be encoded.
Returns:
Resulting encoded string.

decodeAsString

public static String decodeAsString(byte[] buffer)
Decodes array of bytes using base64 decoding and returns the result as a string.

Parameters:
buffer - Array of bytes to be decoded.
Returns:
Resulting decoded string.

decodeAsString

public static String decodeAsString(String text)
Decodes a string using base64 and returns the result as another string.

Parameters:
text - String to be decoded.
Returns:
Resulting decoded string.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.