Example usage for java.lang String getBytes

List of usage examples for java.lang String getBytes

Introduction

In this page you can find the example usage for java.lang String getBytes.

Prototype

public byte[] getBytes() 

Source Link

Document

Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.

Usage

From source file:Main.java

public static byte[] stringToByteArray(String string) {
    return string.getBytes();
}

From source file:Main.java

public static boolean hasFullChar(String str) {
    if (str.getBytes().length == str.length()) {
        return false;
    }// w  w  w.j  a va  2s .  com
    return true;
}

From source file:Main.java

public static byte[] string2Bytes(String s) {
    byte[] r = s.getBytes();
    return r;
}

From source file:Main.java

public static int changdu(String ss) {
    byte[] b = ss.getBytes();
    return b.length;
}

From source file:Main.java

public static boolean hasFullSize(String inStr) {
    if (inStr.getBytes().length != inStr.length()) {
        return true;
    }//w  w  w .  j  a  v a 2 s.c om
    return false;
}

From source file:Main.java

public static boolean isNotChin(String password) {
    return (password.getBytes().length == password.length()) ? true : false;

}

From source file:Main.java

private static String getMethodName(String fildeName) {
    byte[] items = fildeName.getBytes();
    items[0] = (byte) ((char) items[0] - 'a' + 'A');
    return new String(items);
}

From source file:Main.java

public static byte[] stringToBytes(String string) {
    return Base64.encode(string.getBytes(), Base64.DEFAULT);
}

From source file:Main.java

public static String getFromBase64(String strBase64) {
    byte[] b64 = strBase64.getBytes();
    String result = new String(Base64.decode(b64, Base64.DEFAULT));
    return result;
}

From source file:Main.java

public static byte[] getBitmapBytes(String base64) {
    return Base64.decode(base64.getBytes(), 5);
}