com.nimbusds.jose.util
Class Base64URL

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

@Immutable
public class Base64URL
extends Object
implements net.minidev.json.JSONAware

Base64URL-encoded object.

Related specifications:

Version:
$version$ (2013-03-20)
Author:
Vladimir Dzhuvinov

Constructor Summary
Base64URL(String base64URL)
          Creates a new Base64URL-encoded object.
 
Method Summary
 byte[] decode()
          Decodes this Base64URL object to a byte array.
 BigInteger decodeToBigInteger()
          Decodes this Base64URL object to an unsigned big integer.
 String decodeToString()
          Decodes this Base64URL object to a string.
static Base64URL encode(BigInteger bigInt)
          Base64URL-encodes the specified big integer, without the sign bit.
static Base64URL encode(byte[] bytes)
          Base64URL-encodes the specified byte array.
static Base64URL encode(String text)
          Base64URL-encodes the specified string.
 boolean equals(Object object)
          Overrides Object.equals().
 int hashCode()
          Overrides Object.hashCode().
 String toJSONString()
          Returns a JSON string representation of this object.
 String toString()
          Returns a Base64URL string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Base64URL

public Base64URL(String base64URL)
Creates a new Base64URL-encoded object.

Parameters:
base64URL - The Base64URL-encoded object value. The value is not validated for having characters from the Base64URL alphabet. Must not be null.
Method Detail

decode

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

Returns:
The resulting byte array.

decodeToBigInteger

public BigInteger decodeToBigInteger()
Decodes this Base64URL object to an unsigned big integer.

Same as new BigInteger(1, base64url.decode()).

Returns:
The resulting big integer.

decodeToString

public String decodeToString()
Decodes this Base64URL object to a string.

Returns:
The resulting string, in the UTF-8 character set.

toJSONString

public 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 String toString()
Returns a Base64URL string representation of this object.

Overrides:
toString in class Object
Returns:
The Base64URL string representation.

hashCode

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

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

equals

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

Overrides:
equals in class 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)
Base64URL-encodes the specified byte array.

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

encode

public static Base64URL encode(BigInteger bigInt)
Base64URL-encodes the specified big integer, without the sign bit.

Parameters:
bigInt - The big integer to encode. Must not be null.
Returns:
The resulting Base64URL object.

encode

public static Base64URL encode(String text)
Base64URL-encodes the specified string.

Parameters:
text - The string to encode. Must be in the UTF-8 character set and not null.
Returns:
The resulting Base64URL object.


Copyright © 2013 NimbusDS. All Rights Reserved.