/** * Indents the next text. * * @throws IOException I/O exception */ protected void indent() throws IOException { if (indent) { out.print('\n'); final int ls = level * indents; for (int l = 0; l < ls; l++) out.print(tab); } }
/** * Returns a hex entity for the specified codepoint. * * @param cp codepoint * @throws IOException I/O exception */ protected final void printHex(final int cp) throws IOException { out.print("&#x"); boolean o = false; for (int i = 3; i >= 0; i--) { final int b = (cp >> (i << 3)) & 0xFF; if (o || b > 0x0F) { out.print(HEX[b >> 4]); } if (o || b != 0) { out.print(HEX[b & 0xF]); o = true; } } out.print(';'); }
/** * Encodes the specified codepoint before printing. * * @param cp codepoint to be encoded and printed * @throws IOException I/O exception */ protected void printChar(final int cp) throws IOException { out.print(cp); }