public void print(String prefix) {

        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);

        if (prefix != null)
            pw.printf("%s", prefix);
        byte[] data = getData();
        int size = size();

        boolean is_bin = false;
        int char_nbr;
        for (char_nbr = 0; char_nbr < size; char_nbr++)
            if (data[char_nbr] < 9 || data[char_nbr] > 127)
                is_bin = true;

        pw.printf("[%03d] ", size);
        int max_size = is_bin ? 35 : 70;
        String elipsis = "";
        if (size > max_size) {
            size = max_size;
            elipsis = "...";
        }
        for (char_nbr = 0; char_nbr < size; char_nbr++) {
            if (is_bin)
                pw.printf("%02X", data[char_nbr]);
            else
                pw.printf("%c", data[char_nbr]);
        }
        pw.printf("%s\n", elipsis);
        pw.flush();
        pw.close();
        try {
            sw.close();
        } catch (IOException e) {
        }

        System.out.print(sw.toString());
    }