MCPcopy Create free account
hub / github.com/diyhi/bbs / encode

Method encode

src/main/java/cms/utils/Base64.java:59–87  ·  view source on GitHub ↗
(byte[] data)

Source from the content-addressed store, hash-verified

57 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1};
58
59 public static String encode(byte[] data) {
60 StringBuffer sb = new StringBuffer();
61 int len = data.length;
62 int i = 0;
63 int b1, b2, b3;
64 while (i < len) {
65 b1 = data[i++] & 0xff;
66 if (i == len) {
67 sb.append(base64EncodeChars[b1 >>> 2]);
68 sb.append(base64EncodeChars[(b1 & 0x3) << 4]);
69 sb.append("==");
70 break;
71 }
72 b2 = data[i++] & 0xff;
73 if (i == len) {
74 sb.append(base64EncodeChars[b1 >>> 2]);
75 sb.append(base64EncodeChars[((b1 & 0x03) << 4) | ((b2 & 0xf0) >>> 4)]);
76 sb.append(base64EncodeChars[(b2 & 0x0f) << 2]);
77 sb.append("=");
78 break;
79 }
80 b3 = data[i++] & 0xff;
81 sb.append(base64EncodeChars[b1 >>> 2]);
82 sb.append(base64EncodeChars[((b1 & 0x03) << 4) | ((b2 & 0xf0) >>> 4)]);
83 sb.append(base64EncodeChars[((b2 & 0x0f) << 2) | ((b3 & 0xc0) >>> 6)]);
84 sb.append(base64EncodeChars[b3 & 0x3f]);
85 }
86 return sb.toString();
87 }
88
89 public static String decode(byte[] data) {
90 StringBuffer sb = new StringBuffer();

Callers 14

encryptMethod · 0.95
installMethod · 0.80
commenceMethod · 0.80
handleMethod · 0.80
addCookieMethod · 0.80
downloadResponseMethod · 0.80
rangeDownloadResponseMethod · 0.80
parameterEncodedMethod · 0.80
addMethod · 0.80
addStaffMethod · 0.80
editStaffMethod · 0.80
editSelfInfoMethod · 0.80

Calls 1

toStringMethod · 0.45

Tested by 1

installMethod · 0.64