List of usage examples for java.lang String getBytes
public byte[] getBytes()
From source file:Main.java
public static String getEncodedBasicAuthenticationString(String details) { return "Basic " + Base64.encode(details.getBytes(), Base64.DEFAULT); }
From source file:com.enonic.esl.util.Base64Util.java
public static byte[] decode(String data) { return Base64.decodeBase64(data.getBytes()); }
From source file:Main.java
public static InputStream str2InputStream(String str) { return new ByteArrayInputStream(str.getBytes()); }
From source file:Main.java
public static boolean isNumber(String validString) { byte tempbyte[] = validString.getBytes(); for (int i = 0; i < validString.length(); i++) { if (tempbyte[i] < 48 || tempbyte[i] > 57) { return false; }// w w w . ja v a 2 s.c om } return true; }
From source file:Main.java
public static String encData(String data) { String e = Base64.encodeToString(data.getBytes(), Base64.DEFAULT); return e.substring(0, 2) + "JX" + e.substring(2); }
From source file:Main.java
public static String base64Decode(String str) { return Base64.decode(str.getBytes(), Base64.DEFAULT).toString(); }
From source file:Main.java
public static String decode(String content) { return new String(Base64.decode(content.getBytes(), Base64.DEFAULT)); }
From source file:Main.java
public static String encode(String encodeStr) { return Base64.encodeToString(encodeStr.getBytes(), Base64.DEFAULT); }
From source file:Main.java
public static byte[] fromBase64String(String base64String) { return Base64.decodeBase64(base64String.getBytes()); }
From source file:Main.java
public static boolean isPureAscii(String v) { byte bytearray[] = v.getBytes(); CharsetDecoder d = Charset.forName("US-ASCII").newDecoder(); try {/*from w ww . j av a2 s . c om*/ CharBuffer r = d.decode(ByteBuffer.wrap(bytearray)); r.toString(); } catch (CharacterCodingException e) { return false; } return true; }