@Override
    public String toString() {
        final String s = red.toString();
        final StringBuilder h = new StringBuilder();
        // Hex dump the small ones.
        if (s.length() < 8) {
            for (int i = 0; i < s.length(); i++) {
                h.append(" ").append(Integer.toHexString(s.charAt(i)));
            }
        }
        return "[" + given + "]-\"" + s + "\"" + (h.length() > 0 ? " (" + h + ")" : "");
    }
@Test
    public void testToString() throws IOException {
        String data = "test";
        InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
        XmlInputStream instance = new XmlInputStream(stream);
        int r = instance.read();
        assertEquals('t', r);
        String expResult = "[1]-\"t\" ( 74)";
        String result = instance.toString();
        assertEquals(expResult, result);
        r = instance.read();
        assertEquals('e', r);
        expResult = "[2]-\"te\" ( 74 65)";
        result = instance.toString();
        assertEquals(expResult, result);

    }