本文整理了Java中jodd.util.Base64.encodeToByte()
方法的一些代码示例,展示了Base64.encodeToByte()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.encodeToByte()
方法的具体详情如下:
包路径:jodd.util.Base64
类名称:Base64
方法名:encodeToByte
[英]Encodes a raw byte array into a BASE64 char[]
.
[中]将原始字节数组编码为BASE64char[]
。
代码示例来源:origin: redisson/redisson
public static byte[] encodeToByte(byte[] arr) {
return encodeToByte(arr, false);
}
代码示例来源:origin: redisson/redisson
public static byte[] encodeToByte(String s) {
try {
return encodeToByte(s.getBytes(JoddCore.encoding), false);
} catch (UnsupportedEncodingException ignore) {
return null;
}
}
代码示例来源:origin: oblac/jodd
public static byte[] encodeToByte(final byte[] arr) {
return encodeToByte(arr, false);
}
代码示例来源:origin: redisson/redisson
public static byte[] encodeToByte(String s, boolean lineSep) {
try {
return encodeToByte(s.getBytes(JoddCore.encoding), lineSep);
} catch (UnsupportedEncodingException ignore) {
return null;
}
}
代码示例来源:origin: oblac/jodd
public static byte[] encodeToByte(final String s, final boolean lineSep) {
return encodeToByte(StringUtil.getBytes(s), lineSep);
}
代码示例来源:origin: oblac/jodd
public static byte[] encodeToByte(final String s) {
return encodeToByte(StringUtil.getBytes(s), false);
}
代码示例来源:origin: oblac/jodd
@Test
void testUTF8() {
String utf8string = "Здоровая";
String encoded = Base64.encodeToString(utf8string);
String decoded = Base64.decodeToString(encoded);
assertEquals(utf8string, decoded);
for (int i = 0; i < 10; i++) {
utf8string += utf8string;
}
assertTrue(utf8string.length() > 76);
byte[] encodedBytes = Base64.encodeToByte(utf8string, true);
decoded = Base64.decodeToString(encodedBytes);
assertEquals(utf8string, decoded);
encoded = Base64.encodeToString(utf8string, true);
decoded = Base64.decodeToString(encoded);
assertEquals(utf8string, decoded);
}
代码示例来源:origin: org.jodd/jodd-core
public static byte[] encodeToByte(final byte[] arr) {
return encodeToByte(arr, false);
}
代码示例来源:origin: org.jodd/jodd-core
public static byte[] encodeToByte(final String s) {
return encodeToByte(StringUtil.getBytes(s), false);
}
代码示例来源:origin: org.jodd/jodd-core
public static byte[] encodeToByte(final String s, final boolean lineSep) {
return encodeToByte(StringUtil.getBytes(s), lineSep);
}
代码示例来源:origin: com.threewks.thundr/thundr
private void addAttachments(Multipart multipart, List<Attachment> attachments) throws MessagingException {
for (Attachment attachment : attachments) {
InMemoryResponse renderedResult = render(attachment.view());
byte[] base64Encoded = Base64.encodeToByte(renderedResult.getBodyAsBytes());
InternetHeaders headers = new InternetHeaders();
headers.addHeader(Header.ContentType, renderedResult.getContentTypeString());
headers.addHeader(Header.ContentTransferEncoding, "base64");
MimeBodyPart part = new MimeBodyPart(headers, base64Encoded);
part.setFileName(attachment.name());
part.setDisposition(attachment.disposition().value());
if (attachment.isInline()) {
part.setContentID(attachment.contentId());
}
multipart.addBodyPart(part);
}
}
代码示例来源:origin: 3wks/thundr
private void addAttachments(Multipart multipart, List<Attachment> attachments) throws MessagingException {
for (Attachment attachment : attachments) {
InMemoryResponse renderedResult = render(attachment.view());
byte[] base64Encoded = Base64.encodeToByte(renderedResult.getBodyAsBytes());
InternetHeaders headers = new InternetHeaders();
headers.addHeader(Header.ContentType, renderedResult.getContentTypeString());
headers.addHeader(Header.ContentTransferEncoding, "base64");
MimeBodyPart part = new MimeBodyPart(headers, base64Encoded);
part.setFileName(attachment.name());
part.setDisposition(attachment.disposition().value());
if (attachment.isInline()) {
part.setContentID(attachment.contentId());
}
multipart.addBodyPart(part);
}
}
内容来源于网络,如有侵权,请联系作者删除!