Example usage for org.apache.commons.codec.binary BinaryCodec toAsciiChars

List of usage examples for org.apache.commons.codec.binary BinaryCodec toAsciiChars

Introduction

In this page you can find the example usage for org.apache.commons.codec.binary BinaryCodec toAsciiChars.

Prototype

public static char[] toAsciiChars(byte[] raw) 

Source Link

Document

Converts an array of raw binary data into an array of ascii 0 and 1 characters.

Usage

From source file:org.owasp.jbrofuzz.encode.EncoderHashCore.java

private static String encodeBinary(final String encodeText) {
    return new String(BinaryCodec.toAsciiChars(encodeText.getBytes()));
}

From source file:tk.jomp16.plugin.codecutils.CodecUtils.java

public static String getBinary(String text) {
    StringBuilder builder = new StringBuilder();
    String tmp = new String(BinaryCodec.toAsciiChars(text.getBytes()));

    int i1 = 0;/*from ww  w  . ja v  a2s  .co m*/
    for (int i = 0; i < tmp.length(); i++) {
        if (i1 == 8) {
            builder.append(' ');
            i1 = 0;
        }
        builder.append(tmp.charAt(i));
        i1++;
    }

    return builder.toString();
}