List of usage examples for android.util Base64 NO_WRAP
int NO_WRAP
To view the source code for android.util Base64 NO_WRAP.
Click Source Link
From source file:Main.java
public static String fromBytes(byte[] bytes) { try {// w w w .j ava 2 s . c om return new String(Base64.encode(bytes, Base64.NO_WRAP), CHARSET); } catch (Exception e) { return null; } }
From source file:Main.java
public static String createBasicAuthToken(String username, String password) { String credentials = username + ":" + password; String base64EncodedCredentials = Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); final String token = "Basic " + base64EncodedCredentials; return token; }
From source file:Main.java
public static byte[] toBytes(String base64) { try {/* w ww .j av a 2 s .co m*/ return Base64.decode(base64.getBytes(CHARSET), Base64.NO_WRAP); } catch (Exception e) { return null; } }
From source file:Main.java
public static String createAuthorizationString(String username, String password) { String usernamePassword = username + ":" + password; return "Basic " + Base64.encodeToString(usernamePassword.getBytes(), Base64.NO_WRAP); }
From source file:Main.java
@NonNull public static String getBasicAuthorizationHeaderContent(String login, String password) { return "Basic " + Base64.encodeToString((login + ":" + password).getBytes(), Base64.NO_WRAP); }
From source file:Main.java
public static String encodeCredentials(String username, String password) { String cred = username + ":" + password; String encodedValue = null;// www .j a v a 2 s . co m byte[] encodedBytes = Base64.encode(cred.getBytes(), Base64.NO_WRAP); encodedValue = new String(encodedBytes); System.out.println("encodedBytes " + new String(encodedBytes)); byte[] decodedBytes = Base64.decode(encodedBytes, Base64.NO_WRAP); System.out.println("decodedBytes " + new String(decodedBytes)); return encodedValue; }
From source file:Main.java
static public byte[] decodeToByte(String code) { if (code == null || code.length() == 0) { return null; }//from w ww . j av a 2 s . c o m return Base64.decode(code.getBytes(), Base64.NO_WRAP); }
From source file:Main.java
static public String encodeToString(String code) { if (code == null || code.length() == 0) { return ""; }/* www. j a va2 s.c om*/ return Base64.encodeToString(code.getBytes(), Base64.NO_WRAP); }
From source file:Main.java
public static String getFromBase64(String str) { String result = ""; if (str != null) { try {/* w w w. ja v a 2 s. c om*/ result = new String(Base64.decode(str, Base64.NO_WRAP), "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return result; }
From source file:Main.java
public static String getBase64(String str) { String result = ""; if (str != null) { try {/*from w ww . ja v a 2s .c o m*/ result = new String(Base64.encode(str.getBytes("utf-8"), Base64.NO_WRAP), "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return result; }