Java Base64 base64Append(StringBuilder sb, int digit, boolean haveNonZero)

Here you can find the source of base64Append(StringBuilder sb, int digit, boolean haveNonZero)

Description

base Append

License

Apache License

Declaration

private static boolean base64Append(StringBuilder sb, int digit, boolean haveNonZero) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static boolean base64Append(StringBuilder sb, int digit, boolean haveNonZero) {
        if (digit > 0) {
            haveNonZero = true;//  w  w w  .  j a v  a2s.  c o  m
        }
        if (haveNonZero) {
            int c;
            if (digit < 26) {
                c = 'A' + digit;
            } else if (digit < 52) {
                c = 'a' + digit - 26;
            } else if (digit < 62) {
                c = '0' + digit - 52;
            } else if (digit == 62) {
                c = '$';
            } else {
                c = '_';
            }
            sb.append((char) c);
        }
        return haveNonZero;
    }
}

Related

  1. base64(final byte[] stringArray)
  2. Base64(String msg)
  3. base64(String string)
  4. base64(String value)
  5. base64Append(StringBuilder sb, int digit, boolean haveNonZero)
  6. base64Character(int number)
  7. base64CharToValue(byte c)
  8. base64enc(byte[] in)
  9. base64Pad(String s)