List of usage examples for java.lang String getBytes
public byte[] getBytes()
From source file:Main.java
public static byte[] decode(String base64) throws Exception { return Base64.decode(base64.getBytes(), Base64.NO_PADDING); }
From source file:Main.java
/** * Return the MD5 or a string and byte array. * // w w w . java2 s. com * @throws NoSuchAlgorithmException */ public final static byte[] md5(String s) throws NoSuchAlgorithmException { return md5(s.getBytes()); }
From source file:Main.java
public static String encodeStringToStringBySystem(String dataStr, int Base64Flags) { byte[] data = dataStr.getBytes(); return Base64.encodeToString(data, Base64Flags); }
From source file:Main.java
public static String getCnASCII(String cnStr) { StringBuffer strBuf = new StringBuffer(); byte[] bGBK = cnStr.getBytes(); for (int i = 0; i < bGBK.length; i++) { strBuf.append(Integer.toHexString(bGBK[i] & 0xff)); }//www .j a v a 2 s . co m return strBuf.toString(); }
From source file:Main.java
public static String clearDateInfo(String strInfo) { if (strInfo != null && hasDateInfo(strInfo.getBytes())) { strInfo = strInfo.substring(strInfo.indexOf(mSeparator) + 1, strInfo.length()); }//from ww w. j a v a2 s . c o m return strInfo; }
From source file:Main.java
/** * Gets the bitmap image./* w w w . j av a 2 s . c om*/ * * @param context the context * @param base64 the base64 * @return the bitmap image */ public static Bitmap getBitmapImage(Context context, String base64) { byte[] imageAsBytes = Base64.decode(base64.getBytes(), 5); return BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length); }
From source file:Main.java
private static void writeInstallationFile(File installation) throws IOException { FileOutputStream out = new FileOutputStream(installation); String id = UUID.randomUUID().toString(); out.write(id.getBytes()); out.close();// ww w. j av a 2 s . co m }
From source file:com.roncoo.adminlte.util.Base64Util.java
/** * //from w ww. ja v a 2 s . c om * * @param key * @return */ public static String encrypt(String key) { byte[] ec = Base64.encodeBase64(key.getBytes(), true); String ec_result = new String(ec).replaceAll("\r|\n", ""); return ec_result; }
From source file:com.roncoo.adminlte.util.Base64Util.java
/** * //from w w w .j a v a2 s .c o m * * @param key * @return */ public static String decode(String key) { byte[] dc = Base64.decodeBase64(key.getBytes()); String dc_result = new String(dc).replaceAll("\r|\n", ""); return dc_result; }
From source file:de.defmacro.dandelion.internal.core.connection.protocol.ProtocolUtilities.java
/** * Kodierung eines Strings in Base64.//from ww w .j a v a2s . c o m * @param string - zu kodierender String * @return */ public static String encodeBase64(String string) { return new String(BASE64.encode(string.getBytes())); }