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 Bitmap ByteToBitmap(String strbyte) {
    byte[] bytes = Base64.decode(strbyte.getBytes(), 1);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}

From source file:Main.java

public static String getBase64(final String input) {
    return Base64.encodeToString(input.getBytes(), Base64.NO_WRAP);
}

From source file:Main.java

public static String decipher(String base64Str) {
    return new String(Base64.decode(base64Str.getBytes(), Base64.DEFAULT));
}

From source file:Main.java

public static String enToStr(String str) {
    String enStr = Base64.encodeToString(str.getBytes(), Base64.DEFAULT);
    return enStr;
}

From source file:Main.java

public static String checkXMLSting(String origStr) {
    byte[] origBytes = origStr.getBytes();
    StringBuffer sb = new StringBuffer(origBytes.length);
    for (int i = 0; i < origBytes.length; i++) {
        System.out.println(i + "  =" + String.valueOf(origBytes[i]));
        if (origBytes[i] < 0)
            sb.append(" ");
        else//  ww w  .j av a  2 s . c o  m
            sb.append(origStr.substring(i, i + 1));
    }
    return sb.toString();
}

From source file:Main.java

public static String getBase64Code(String str, long port) {
    byte[] b = Base64.encode(str.getBytes(), Base64.DEFAULT);
    return "http://127.0.0.1:" + port + "/play?enc=base64&url=" + new String(b) + "&taskid=&mediatype=m3u8";
}

From source file:Main.java

private static InputStream stream(String contents) {
    return new ByteArrayInputStream(contents.getBytes());
}

From source file:Main.java

public static Bitmap base64ToBitmap(String b64) {
    byte[] imageAsBytes = Base64.decode(b64.getBytes(), Base64.DEFAULT);
    return BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length);
}

From source file:Main.java

public static byte[] decode(String base64) throws Exception {
    return Base64.decode(base64.getBytes(), Base64.DEFAULT);
}

From source file:Main.java

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