类 Base64
- java.lang.Object
-
- dev.utils.common.cipher.Base64
-
public final class Base64 extends java.lang.Objectdetail: Base64 工具类- 作者:
- Android
-
-
字段概要
字段 修饰符和类型 字段 说明 static intCRLFEncoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF.static intDEFAULTDefault values for encoder/decoder flags.static intNO_CLOSEFlag to pass to Base64OutputStream to indicate that it should not close the output stream it is wrapping when it itself is closed.static intNO_PADDINGEncoder flag bit to omit the padding '=' characters at the end of the output (if any).static intNO_WRAPEncoder flag bit to omit all line terminators (i.e., the output will be on one long line).static intURL_SAFEEncoder/decoder flag bit to indicate using the "URL and filename safe" variant of Base64 (see RFC 3548 section 4) where-and_are used in place of+and/.
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static byte[]decode(byte[] input, int flags)Decode the Base64-encoded data in input and return the data in a new byte array.static byte[]decode(byte[] input, int offset, int len, int flags)Decode the Base64-encoded data in input and return the data in a new byte array.static byte[]decode(java.lang.String str, int flags)Decode the Base64-encoded data in input and return the data in a new byte array.static byte[]encode(byte[] input, int flags)Base64-encode the given data and return a newly allocated byte[] with the result.static byte[]encode(byte[] input, int offset, int len, int flags)Base64-encode the given data and return a newly allocated byte[] with the result.static java.lang.StringencodeToString(byte[] input, int flags)Base64-encode the given data and return a newly allocated String with the result.static java.lang.StringencodeToString(byte[] input, int offset, int len, int flags)Base64-encode the given data and return a newly allocated String with the result.
-
-
-
字段详细资料
-
DEFAULT
public static final int DEFAULT
Default values for encoder/decoder flags.- 另请参阅:
- 常量字段值
-
NO_PADDING
public static final int NO_PADDING
Encoder flag bit to omit the padding '=' characters at the end of the output (if any).- 另请参阅:
- 常量字段值
-
NO_WRAP
public static final int NO_WRAP
Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).- 另请参阅:
- 常量字段值
-
CRLF
public static final int CRLF
Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF. Has no effect ifNO_WRAPis specified as well.- 另请参阅:
- 常量字段值
-
URL_SAFE
public static final int URL_SAFE
Encoder/decoder flag bit to indicate using the "URL and filename safe" variant of Base64 (see RFC 3548 section 4) where-and_are used in place of+and/.- 另请参阅:
- 常量字段值
-
NO_CLOSE
public static final int NO_CLOSE
Flag to pass to Base64OutputStream to indicate that it should not close the output stream it is wrapping when it itself is closed.- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
decode
public static byte[] decode(java.lang.String str, int flags)Decode the Base64-encoded data in input and return the data in a new byte array.The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
- 参数:
str- the input String to decode, which is converted to bytes using the default charsetflags- controls certain features of the decoded output. PassDEFAULTto decode standard Base64.- 抛出:
java.lang.IllegalArgumentException- if the input contains incorrect padding
-
decode
public static byte[] decode(byte[] input, int flags)Decode the Base64-encoded data in input and return the data in a new byte array.The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
- 参数:
input- the input array to decodeflags- controls certain features of the decoded output. PassDEFAULTto decode standard Base64.- 抛出:
java.lang.IllegalArgumentException- if the input contains incorrect padding
-
decode
public static byte[] decode(byte[] input, int offset, int len, int flags)Decode the Base64-encoded data in input and return the data in a new byte array.The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
- 参数:
input- the data to decodeoffset- the position within the input array at which to startlen- the number of bytes of input to decodeflags- controls certain features of the decoded output. PassDEFAULTto decode standard Base64.- 抛出:
java.lang.IllegalArgumentException- if the input contains incorrect padding
-
encodeToString
public static java.lang.String encodeToString(byte[] input, int flags)Base64-encode the given data and return a newly allocated String with the result.- 参数:
input- the data to encodeflags- controls certain features of the encoded output. PassingDEFAULTresults in output that adheres to RFC 2045.
-
encodeToString
public static java.lang.String encodeToString(byte[] input, int offset, int len, int flags)Base64-encode the given data and return a newly allocated String with the result.- 参数:
input- the data to encodeoffset- the position within the input array at which to startlen- the number of bytes of input to encodeflags- controls certain features of the encoded output. PassingDEFAULTresults in output that adheres to RFC 2045.
-
encode
public static byte[] encode(byte[] input, int flags)Base64-encode the given data and return a newly allocated byte[] with the result.- 参数:
input- the data to encodeflags- controls certain features of the encoded output. PassingDEFAULTresults in output that adheres to RFC 2045.
-
encode
public static byte[] encode(byte[] input, int offset, int len, int flags)Base64-encode the given data and return a newly allocated byte[] with the result.- 参数:
input- the data to encodeoffset- the position within the input array at which to startlen- the number of bytes of input to encodeflags- controls certain features of the encoded output. PassingDEFAULTresults in output that adheres to RFC 2045.
-
-