com.nimbusds.jose.util
Class Base64

java.lang.Object
  extended by com.nimbusds.jose.util.Base64
All Implemented Interfaces:
net.minidev.json.JSONAware

@Immutable
public class Base64
extends java.lang.Object
implements net.minidev.json.JSONAware

Base64-encoded object.

Version:
$version$ (2012-01-15)
Author:
Vladimir Dzhuvinov

Constructor Summary
Base64(java.lang.String base64)
          Creates a new Base64-encoded object.
 
Method Summary
 byte[] decode()
          Decodes this Base64 object to a byte array.
static Base64URL encode(byte[] bytes)
          Base64-encode the specified byte array.
 boolean equals(java.lang.Object object)
          Overrides Object.equals().
 int hashCode()
          Overrides Object.hashCode().
 java.lang.String toJSONString()
          Returns a JSON string representation of this object.
 java.lang.String toString()
          Returns a Base64 string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Base64

public Base64(java.lang.String base64)
Creates a new Base64-encoded object.

Parameters:
base64 - The Base64-encoded object value. The value is not validated for having characters from a Base64 alphabet. Must not be null.
Method Detail

decode

public byte[] decode()
Decodes this Base64 object to a byte array.

Returns:
The resulting byte array.

toJSONString

public java.lang.String toJSONString()
Returns a JSON string representation of this object.

Specified by:
toJSONString in interface net.minidev.json.JSONAware
Returns:
The JSON string representation of this object.

toString

public java.lang.String toString()
Returns a Base64 string representation of this object. The string will be chunked into 76 character blocks separated by CRLF.

Overrides:
toString in class java.lang.Object
Returns:
The Base64 string representation, chunked into 76 character blocks separated by CRLF.

hashCode

public int hashCode()
Overrides Object.hashCode().

Overrides:
hashCode in class java.lang.Object
Returns:
The object hash code.

equals

public boolean equals(java.lang.Object object)
Overrides Object.equals().

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to compare to.
Returns:
true if the objects have the same value, otherwise false.

encode

public static Base64URL encode(byte[] bytes)
Base64-encode the specified byte array.

Parameters:
bytes - The byte array to encode. Must not be null.
Returns:
The resulting Base64 object.


Copyright © 2013 NimbusDS. All Rights Reserved.