base64编码

@param source 被编码的base64字符串
@param charset 字符集
@return 被加密后的字符串
484256
public static String encode(String source, String charset) {
		return Base64Encoder.encode(source, charset);
	}
226978
public String encode(Object source) {

        return net.arnx.jsonic.JSON.encode(source, true);
    }
872025
public static String encodeUrlSafe(byte[] source, String charset) {
		return StrUtil.str(encodeUrlSafe(source, false), charset);
	}
244834
public static String encodeStringsAsBase64Parameter(List<String> strings) {

        JSONArray array = new JSONArray();
        for (String string : strings) {
            array.put(string);
        }
        byte[] bytes;
        try {
            // use obfuscateBytes here to to make the output look more random
            bytes = obfuscateBytes(array.toString().getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            // should never happen
            e.printStackTrace();
            throw new RuntimeException(e);
        }
        String result = Base64.encodeBase64String(bytes);
        result = StringUtils.replaceChars(result, BASE64_EXTRA, BASE64_EXTRA_REPLACEMENTS);
        return result;
    }
465577
public static String convertToBase64(String source) {
        if (source == null) {
            return null;
        }
        return Base64.encodeBase64URLSafeString(StringUtils.getBytesUtf8(source));
    }
50787
public String readStringLengthEncoded(final Charset charset) {
    int length = (int) getLengthEncodedNumeric();
    String string = new String(buf, position, length, charset);
    position += length;
    return string;
  }
1283009
public CharSequence process(CharSequence source) {
        Context context = new Context();
        StringBuilder target = new StringBuilder(source.length());
        context.setTarget(target);
        Source source1 = new Source(source);
        source1.setConstantSet(constants);
        context.setSource(source1);
        context.setScope(scope);
        context.setNestingLimit(nestingLimit*2);
        if (params != null) {
            for (Map.Entry<String, CharSequence> entry : params.entrySet()) {
                context.setAttribute(entry.getKey(), entry.getValue());
            }
        }

        try {
            prefix.generate(context);
            boolean success = scope.process(context);
            suffix.generate(context);

            if(!success){
                target = new StringBuilder(0);
            }
        } catch (NestingException e) {
            target = new StringBuilder(0);
            if(propagateNestingException){
                throw new TextProcessorNestingException(nestingLimit);
            }
        }

        return target;
    }
1250678
public char[] prepareSource(char[] source) {
        char[] src = new char[source.length + 2];
        System.arraycopy(source, 0, src, 0, source.length);
        src[source.length] = '\n';
        src[source.length + 1] = '\n';
        return src;
    }
425532
public static String base64Encode(String rawStr,String encoding) throws IOException{
		byte [] rawByte = rawStr.getBytes(encoding);
		return new String(SecureUtil.base64Encode(rawByte),encoding);
	}
541773
public static String encode(final String source) {
		if (source == null) {
			return null;
		}
		return encodeInToBase64(source.getBytes());
	}
760700
public static ByteBuf encodeStringAsUtf8(String source) {
        ByteBuf target = Unpooled.buffer(source.length());
        ByteBufUtil.writeUtf8(target, source);
        return target;
    }
1363587
public static String percentEncode(String source) throws AuthException {
    try {
      return URLEncoder.encode(source, "UTF-8")
          .replace("+", "%20")
          .replace("*", "%2A")
          .replace("%7E", "~");
    } catch (UnsupportedEncodingException ex) {
      throw new AuthException("cannot encode value '" + source + "'", ex);
    }
  }
120629
@FindbugsSuppressWarnings("DM_DEFAULT_ENCODING")
  public static String encodeBase64(String data) {
    final byte[] encodedBytes = Base64.encodeBase64(data.getBytes());

    return new String(encodedBytes);
  }
265736
public byte[] encrypt(String data, String charset) {
		return encrypt(StrUtil.bytes(data, charset));
	}
1014559
public String encryptBase64(String data, String charset) {
		return Base64.encode(encrypt(data, charset));
	}
1244001
public static String encode(byte[] source, String charset) {
		return StrUtil.str(encode(source, false), charset);
	}
324795
public static String encodeBytes(byte[] source, int off, int len) {
        return encodeBytes(source, off, len, NO_OPTIONS);
    }