org.apache.commons.codec.binary.Base64 # getEncodedLength ( ) 源码实例Demo

下面列出了 org.apache.commons.codec.binary.Base64 # getEncodedLength ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: das   文件: DalBase64.java

public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe,
        final int maxResultSize) {
    if (binaryData == null || binaryData.length == 0) {
        return binaryData;
    }

    // Create this so can use the super-class method
    // Also ensures that the same roundings are performed by the ctor and the code
    final Base64 b64 = isChunked ? new DalBase64(urlSafe) : new DalBase64(0, CHUNK_SEPARATOR, urlSafe);
    final long len = b64.getEncodedLength(binaryData);
    if (len > maxResultSize) {
        throw new IllegalArgumentException("Input array too big, the output array would be bigger (" + len
                + ") than the specified maximum size of " + maxResultSize);
    }

    return b64.encode(binaryData);
}
 
源代码2 项目: dal   文件: DalBase64.java

public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe,
        final int maxResultSize) {
    if (binaryData == null || binaryData.length == 0) {
        return binaryData;
    }

    // Create this so can use the super-class method
    // Also ensures that the same roundings are performed by the ctor and the code
    final Base64 b64 = isChunked ? new DalBase64(urlSafe) : new DalBase64(0, CHUNK_SEPARATOR, urlSafe);
    final long len = b64.getEncodedLength(binaryData);
    if (len > maxResultSize) {
        throw new IllegalArgumentException("Input array too big, the output array would be bigger (" + len
                + ") than the specified maximum size of " + maxResultSize);
    }

    return b64.encode(binaryData);
}