Base64Util.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:CacheManage 作者:
public static boolean check(String str) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(new StringBufferInputStream(str)));
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    String line = null;
    String lastLine = null;

    byte[] lastLineBytes;
    while ((line = br.readLine()) != null) {
        lastLine = line;
        lastLineBytes = line.getBytes();
        tryAllocate(buffer, lastLineBytes.length);
        buffer.put(lastLineBytes);
    }

    lastLineBytes = lastLine.getBytes();
    int equalsNum = 0;

    for (int src = lastLineBytes.length - 1; src >= lastLineBytes.length - 2; --src) {
        if (lastLineBytes[src] == 61) {
            ++equalsNum;
        }
    }

    byte[] var10 = buffer.toString().getBytes();

    for (int i = 0; i < var10.length - equalsNum; ++i) {
        char c = (char) var10[i];
        if ((c < 97 || c > 122) && (c < 65 || c > 90) && (c < 48 || c > 57) && c != 43 && c != 47) {
            return false;
        }
    }

    if ((var10.length - equalsNum) % 4 != 0) {
        return false;
    } else {
        return true;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号