/** * Translates the specified Base64 string (as per Preferences.get(byte[])) * into a byte array. * * @throw IllegalArgumentException if <tt>s</tt> is not a valid Base64 * string. */ static byte[] base64ToByteArray(String s) { return base64ToByteArray(s, false); }
/** * Translates the specified byte array into a Base64 string as per * Preferences.put(byte[]). */ static String byteArrayToBase64(byte[] a) { return byteArrayToBase64(a, false); }
int ch0 = base64toInt(s.charAt(inCursor++), alphaToInt); int ch1 = base64toInt(s.charAt(inCursor++), alphaToInt); int ch2 = base64toInt(s.charAt(inCursor++), alphaToInt); int ch3 = base64toInt(s.charAt(inCursor++), alphaToInt); result[outCursor++] = (byte) ((ch0 << 2) | (ch1 >> 4)); result[outCursor++] = (byte) ((ch1 << 4) | (ch2 >> 2)); int ch0 = base64toInt(s.charAt(inCursor++), alphaToInt); int ch1 = base64toInt(s.charAt(inCursor++), alphaToInt); result[outCursor++] = (byte) ((ch0 << 2) | (ch1 >> 4)); int ch2 = base64toInt(s.charAt(inCursor++), alphaToInt); result[outCursor++] = (byte) ((ch1 << 4) | (ch2 >> 2));
/** * Translates the specified "aternate representation" Base64 string * into a byte array. * * @throw IllegalArgumentException or ArrayOutOfBoundsException * if <tt>s</tt> is not a valid alternate representation * Base64 string. */ static byte[] altBase64ToByteArray(String s) { return base64ToByteArray(s, true); }
/** * Translates the specified byte array into an "aternate representation" * Base64 string. This non-standard variant uses an alphabet that does * not contain the uppercase alphabetic characters, which makes it * suitable for use in situations where case-folding occurs. */ static String byteArrayToAltBase64(byte[] a) { return byteArrayToBase64(a, true); }
return new Authenticator.Failure (401); byte[] b = Base64.base64ToByteArray (auth.substring(sp+1)); String userpass = new String (b); int colon = userpass.indexOf (':');