本文整理了Java中org.apache.commons.net.util.Base64.<init>()
方法的一些代码示例,展示了Base64.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.<init>()
方法的具体详情如下:
包路径:org.apache.commons.net.util.Base64
类名称:Base64
方法名:<init>
[英]Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode.
When encoding the line length is 76, the line separator is CRLF, and the encoding table is STANDARD_ENCODE_TABLE.
When decoding all variants are supported.
[中]
代码示例来源:origin: commons-net/commons-net
/**
* Decodes Base64 data into octets
*
* @param base64Data
* Byte array containing Base64 data
* @return Array containing decoded data.
*/
public static byte[] decodeBase64(byte[] base64Data) {
return new Base64().decode(base64Data);
}
代码示例来源:origin: commons-net/commons-net
/**
* Decodes a Base64 String into octets
*
* @param base64String
* String containing Base64 data
* @return Array containing decoded data.
* @since 1.4
*/
public static byte[] decodeBase64(String base64String) {
return new Base64().decode(base64String);
}
代码示例来源:origin: commons-net/commons-net
/**
* Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks.
*
* @param binaryData
* Array containing binary data to encode.
* @param isChunked
* if <code>true</code> this encoder will chunk the base64 output into 76 character blocks
* @param urlSafe
* if <code>true</code> this encoder will emit - and _ instead of the usual + and / characters.
* @param maxResultSize
* The maximum result size to accept.
* @return Base64-encoded data.
* @throws IllegalArgumentException
* Thrown when the input array needs an output array bigger than maxResultSize
* @since 1.4
*/
public static byte[] encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize) {
if (binaryData == null || binaryData.length == 0) {
return binaryData;
}
long len = getEncodeLength(binaryData, isChunked ? CHUNK_SIZE : 0, isChunked ? CHUNK_SEPARATOR : EMPTY_BYTE_ARRAY);
if (len > maxResultSize) {
throw new IllegalArgumentException("Input array too big, the output array would be bigger (" +
len +
") than the specified maxium size of " +
maxResultSize);
}
Base64 b64 = isChunked ? new Base64(urlSafe) : new Base64(0, CHUNK_SEPARATOR, urlSafe);
return b64.encode(binaryData);
}
代码示例来源:origin: pl.edu.icm.synat/synat-oai-server
void deSerialize(String token) throws OAIInternalServerError, BadResumptionTokenException {
try {
Base64 dec = new Base64();
byte[] b = dec.decode(token);
ByteArrayInputStream bis = new ByteArrayInputStream(b);
ObjectInputStream ois = new ObjectInputStream(bis);
dOrigFrom = new Date(ois.readLong());
dUntil = new Date(ois.readLong());
lastElDate = new Date(ois.readLong());
lastElId = ois.readUTF();
metadataPref = ois.readUTF();
} catch (IOException e) {
log.error(e.getMessage(), e);
throw new BadResumptionTokenException();
// throw new OAIInternalServerError("Iternal java error during serialisation");
}
}
内容来源于网络,如有侵权,请联系作者删除!