Base64.encodeToString(数据,数字)中的数字是什么意思?

时间:2016-10-06 13:28:59

标签: java android

我最近看到了很多java编码,其中包括:

Base64.encodeToString(data, 0);

Base64.encodeToString(data, 2);

这个数字到底意味着什么?我怀疑0是默认的还是假的,2是什么意思?也许它与Base64.encodeToString(data, Base64.NO_WRAP)相同?

1 个答案:

答案 0 :(得分:-1)

doc中所述,您可以传递以下标志。每个都有其含义。

int CRLF -> Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF.
int DEFAULT -> Default values for encoder/decoder flags.
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.
int NO_PADDING -> Encoder flag bit to omit the padding '=' characters at the end of the output (if any).
int NO_WRAP -> Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).
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 /.