com.mucommander.io.base64
Class Base64Encoder

java.lang.Object
  extended by com.mucommander.io.base64.Base64Encoder

public abstract class Base64Encoder
extends java.lang.Object

Base64Encoder provides methods to ease the encoding of strings and byte arrays in base64. The Base64OutputStream class is used under the hood to perform the actual base64 encoding.

Author:
Maxence Bernard
See Also:
Base64OutputStream

Constructor Summary
Base64Encoder()
           
 
Method Summary
static java.lang.String encode(byte[] b)
          Base64-encodes the given byte array and returns the result.
static java.lang.String encode(byte[] b, int off, int len)
          Base64-encodes the given byte array, from off to len, and returns the result.
static java.lang.String encode(java.lang.String s)
          Shorthand for encode(String, String) invoked with UTF-8 encoding.
static java.lang.String encode(java.lang.String s, java.lang.String encoding)
          Base64-encodes the given String and returns result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64Encoder

public Base64Encoder()
Method Detail

encode

public static java.lang.String encode(byte[] b)
Base64-encodes the given byte array and returns the result. The specified encoding is used for tranforming the string into bytes.

Parameters:
b - the String to base64-encode
Returns:
the base64-encoded String

encode

public static java.lang.String encode(byte[] b,
                                      int off,
                                      int len)
Base64-encodes the given byte array, from off to len, and returns the result. The specified encoding is used for tranforming the string into bytes.

Parameters:
b - the String to base64-encode
off - position to the first byte in the array to be encoded
len - number of bytes in the array to encode
Returns:
the base64-encoded String

encode

public static java.lang.String encode(java.lang.String s)
Shorthand for encode(String, String) invoked with UTF-8 encoding.

Parameters:
s - the String to base64-encode
Returns:
the base64-encoded String

encode

public static java.lang.String encode(java.lang.String s,
                                      java.lang.String encoding)
                               throws java.io.UnsupportedEncodingException
Base64-encodes the given String and returns result. The specified encoding is used for tranforming the string into bytes.

Parameters:
s - the String to base64-encode
encoding - the character encoding to use for transforming the string into bytes
Returns:
the base64-encoded String
Throws:
java.io.UnsupportedEncodingException - if the specified encoding is not supported by the Java runtime


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard