/** * Writes a single character. * * @param c the character to append. * @return a reference to this {@code Appendable}. * @throws IOException if an I/O error occurs. */ @Override public Appendable append(final char c) throws IOException { final int cp = toCodePoint(c); if (cp >= 0) { write(cp); } return this; }
/** * Writes a single character. * * @param c the character to append. * @return a reference to this {@code Appendable}. * @throws IOException if an I/O error occurs. */ @Override public Appendable append(final char c) throws IOException { final int cp = toCodePoint(c); if (cp >= 0) { write(cp); } return this; }
/** * Writes a portion of a character sequence. * * @param sequence the character sequence to be written. * @param start index from which to start reading characters. * @param end index of the character following the last character to read. * @return a reference to this {@code Appendable}. * @throws IOException if an I/O error occurs. */ @Override public Appendable append(final CharSequence sequence, int start, final int end) throws IOException { ArgumentChecks.ensureValidIndexRange(sequence.length(), start, end); if (lineSeparator == null) { /* * Use the line separator found in the submitted document, if possible. * If we don't find any line separator in the submitted content, leave * the 'lineSeparator' field to null since the 'write' method will set * it to the default value only if it really needs it. */ lineSeparator = lineSeparator(sequence, start, end); } start = appendSurrogate(sequence, start, end); while (start < end) { final int c = toCodePoint(sequence.charAt(start++)); if (c >= 0) { write(c); } } return this; }
/** * Writes a portion of a character sequence. * * @param sequence the character sequence to be written. * @param start index from which to start reading characters. * @param end index of the character following the last character to read. * @return a reference to this {@code Appendable}. * @throws IOException if an I/O error occurs. */ @Override public Appendable append(final CharSequence sequence, int start, final int end) throws IOException { ArgumentChecks.ensureValidIndexRange(sequence.length(), start, end); if (lineSeparator == null) { /* * Use the line separator found in the submitted document, if possible. * If we don't find any line separator in the submitted content, leave * the 'lineSeparator' field to null since the 'write' method will set * it to the default value only if it really needs it. */ lineSeparator = lineSeparator(sequence, start, end); } start = appendSurrogate(sequence, start, end); while (start < end) { final int c = toCodePoint(sequence.charAt(start++)); if (c >= 0) { write(c); } } return this; }