Oracle Security Developer Tools XML Security Java API Reference
10g (10.1.4.0.1)

B28178-01


oracle.security.xmlsec.util
Class Base64

java.lang.Object
  extended byoracle.security.xmlsec.util.Base64


public class Base64
extends java.lang.Object

Implements base-64 encoding as per RFC 1421 (PEM) and RFC 2045 (MIME). If Base64 is set to use line breaks, then a newline ('\n') will be inserted after every 76 characters of the encoded output (MIME).

On input, whitespace characters ('\r', '\n', '\t', ' ') are ignored.


Constructor Summary
Base64()
          Creates a new Base64 instance, that will insert line separators in encoded output.
Base64(boolean useLineBreaks)
          Creates a new Base64 instance.

 

Method Summary
 byte[] decode(java.lang.String s)
          Returns the decoded form of the given Base-64 encoded string.
 java.lang.String encode(byte[] data)
          Returns the Base-64 encoding of the given byte array.
static byte[] fromBase64(java.lang.String s)
          Returns the decoded form of the given Base-64 encoded string.
 boolean getUseLineBreaks()
          Returns true if this Base64 will insert line separators into encoded output.
 void setUseLineBreaks(boolean useLineBreaks)
          Used to indicate whether line separators are to be inserted in the encoded output.
static java.lang.String toBase64(byte[] data, boolean useLineBreaks)
          Returns the Base-64 encoding of the given byte array.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Base64

public Base64()
Creates a new Base64 instance, that will insert line separators in encoded output.
See Also:
setUseLineBreaks(boolean)

Base64

public Base64(boolean useLineBreaks)
Creates a new Base64 instance.
Parameters:
useLineBreaks - If true, will insert line separators in the encoded output.
See Also:
setUseLineBreaks(boolean)

Method Detail

toBase64

public static java.lang.String toBase64(byte[] data,
                                        boolean useLineBreaks)
Returns the Base-64 encoding of the given byte array.
Parameters:
data - The data to be encoded.
useLineBreaks - If true, will insert line separators in the encoded output.

fromBase64

public static byte[] fromBase64(java.lang.String s)
Returns the decoded form of the given Base-64 encoded string. Line breaks and whitespace will be ignored.
Parameters:
s - The string to be decoded.

setUseLineBreaks

public void setUseLineBreaks(boolean useLineBreaks)
Used to indicate whether line separators are to be inserted in the encoded output. If true, then the value of the system property line.separator is used for this purpose.

getUseLineBreaks

public boolean getUseLineBreaks()
Returns true if this Base64 will insert line separators into encoded output.
See Also:
setUseLineBreaks(boolean)

encode

public java.lang.String encode(byte[] data)
Returns the Base-64 encoding of the given byte array.
Parameters:
data - The data to be encoded.

decode

public byte[] decode(java.lang.String s)
Returns the decoded form of the given Base-64 encoded string.

Line breaks will be ignored, provided they are of the form CR, LF, or CRLF, and do not occur twice in a row or in the middle of a four-character block.

Parameters:
s - The string to be decoded.

Oracle Security Developer Tools XML Security Java API Reference
10g (10.1.4.0.1)

B28178-01


Copyright © 2005 ,2006 , Oracle. All rights reserved.