org.eclipse.jetty.util
类 B64Code

java.lang.Object
  继承者 org.eclipse.jetty.util.B64Code
直接已知子类:
B64Code

public class B64Code
extends Object

Fast B64 Encoder/Decoder as described in RFC 1421.

Does not insert or interpret whitespace as described in RFC 1521. If you require this you must pre/post process your data.

Note that in a web context the usual case is to not want linebreaks or other white space in the encoded output.


构造方法摘要
B64Code()
           
 
方法摘要
static byte[] decode(char[] b)
          Fast Base 64 decode as described in RFC 1421.
static byte[] decode(String encoded)
          Base 64 decode as described in RFC 2045.
static void decode(String encoded, ByteArrayOutputStream bout)
          Base 64 decode as described in RFC 2045.
static String decode(String encoded, String charEncoding)
          Base 64 decode as described in RFC 2045.
static char[] encode(byte[] b)
          Fast Base 64 encode as described in RFC 1421.
static char[] encode(byte[] b, boolean rfc2045)
          Fast Base 64 encode as described in RFC 1421 and RFC2045 Does not insert whitespace as described in RFC 1521, unless rfc2045 is passed as true.
static void encode(int value, Appendable buf)
           
static void encode(long lvalue, Appendable buf)
           
static String encode(String s)
          Base 64 encode as described in RFC 1421.
static String encode(String s, String charEncoding)
          Base 64 encode as described in RFC 1421.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

B64Code

public B64Code()
方法详细信息

encode

public static String encode(String s)
Base 64 encode as described in RFC 1421.

Does not insert whitespace as described in RFC 1521.

参数:
s - String to encode.
返回:
String containing the encoded form of the input.

encode

public static String encode(String s,
                            String charEncoding)
                     throws UnsupportedEncodingException
Base 64 encode as described in RFC 1421.

Does not insert whitespace as described in RFC 1521.

参数:
s - String to encode.
charEncoding - String representing the name of the character encoding of the provided input String.
返回:
String containing the encoded form of the input.
抛出:
UnsupportedEncodingException

encode

public static char[] encode(byte[] b)
Fast Base 64 encode as described in RFC 1421.

Does not insert whitespace as described in RFC 1521.

Avoids creating extra copies of the input/output.

参数:
b - byte array to encode.
返回:
char array containing the encoded form of the input.

encode

public static char[] encode(byte[] b,
                            boolean rfc2045)
Fast Base 64 encode as described in RFC 1421 and RFC2045

Does not insert whitespace as described in RFC 1521, unless rfc2045 is passed as true.

Avoids creating extra copies of the input/output.

参数:
b - byte array to encode.
rfc2045 - If true, break lines at 76 characters with CRLF
返回:
char array containing the encoded form of the input.

decode

public static String decode(String encoded,
                            String charEncoding)
                     throws UnsupportedEncodingException
Base 64 decode as described in RFC 2045.

Unlike decode(char[]), extra whitespace is ignored.

参数:
encoded - String to decode.
charEncoding - String representing the character encoding used to map the decoded bytes into a String.
返回:
String decoded byte array.
抛出:
UnsupportedEncodingException - if the encoding is not supported
IllegalArgumentException - if the input is not a valid B64 encoding.

decode

public static byte[] decode(char[] b)
Fast Base 64 decode as described in RFC 1421.

Unlike other decode methods, this does not attempt to cope with extra whitespace as described in RFC 1521/2045.

Avoids creating extra copies of the input/output.

Note this code has been flattened for performance.

参数:
b - char array to decode.
返回:
byte array containing the decoded form of the input.
抛出:
IllegalArgumentException - if the input is not a valid B64 encoding.

decode

public static byte[] decode(String encoded)
Base 64 decode as described in RFC 2045.

Unlike decode(char[]), extra whitespace is ignored.

参数:
encoded - String to decode.
返回:
byte array containing the decoded form of the input.
抛出:
IllegalArgumentException - if the input is not a valid B64 encoding.

decode

public static void decode(String encoded,
                          ByteArrayOutputStream bout)
Base 64 decode as described in RFC 2045.

Unlike decode(char[]), extra whitespace is ignored.

参数:
encoded - String to decode.
output - stream for decoded bytes
抛出:
IllegalArgumentException - if the input is not a valid B64 encoding.

encode

public static void encode(int value,
                          Appendable buf)
                   throws IOException
抛出:
IOException

encode

public static void encode(long lvalue,
                          Appendable buf)
                   throws IOException
抛出:
IOException


Copyright © 2013. All Rights Reserved.