de.tarent.maven.plugins
Class Base64

java.lang.Object
  extended by de.tarent.maven.plugins.Base64

public final class Base64
extends java.lang.Object

Base64 encoding/decoding implementation from GNU Classpath used under GPL + linking exception.

Author:
Robert Schuster

Method Summary
static byte[] decode(java.lang.String b64)
          Decode a Base-64 string into a byte array.
static java.lang.String encode(byte[] buf)
          Base64 encode a byte array, with no line wrapping.
static java.lang.String encode(byte[] buf, int tw)
          Base64 encode a byte array, returning the returning string.
static java.lang.String encode(byte[] buf, int offset, int length, int tw)
          Base64 encode a byte array, returning the returning string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static java.lang.String encode(byte[] buf)
Base64 encode a byte array, with no line wrapping.

Parameters:
buf - The byte array to encode.
Returns:
buf encoded in Base64.

encode

public static java.lang.String encode(byte[] buf,
                                      int tw)
Base64 encode a byte array, returning the returning string.

Parameters:
buf - The byte array to encode.
tw - The total length of any line, 0 for unlimited.
Returns:
buf encoded in Base64.

encode

public static java.lang.String encode(byte[] buf,
                                      int offset,
                                      int length,
                                      int tw)
Base64 encode a byte array, returning the returning string.

Parameters:
buf - The byte array to encode.
offset - The offset in the byte array to start.
length - The number of bytes to encode.
tw - The total length of any line, 0 for unlimited.
Returns:
buf encoded in Base64.

decode

public static byte[] decode(java.lang.String b64)
                     throws java.io.IOException
Decode a Base-64 string into a byte array.

Parameters:
b64 - The Base-64 encoded string.
Returns:
The decoded bytes.
Throws:
java.io.IOException - If the argument is not a valid Base-64 encoding.


Copyright © 2007. All Rights Reserved.