Interface UnicodeWriter

All Known Implementing Classes:
UnicodeBuilder, UnicodeWriterToWriter, UTF8Writer

public interface UnicodeWriter
Interface that accepts strings in the form of UnicodeString objects, which are written to some destination. It also accepts ordinary String objects.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    default void
    Complete the writing of characters to the result.
    default void
    Flush the contents of any buffers.
    void
    write(String chars)
    Process a supplied string
    void
    Process a supplied string
    void
    writeAscii(byte[] content)
    Write a supplied string known to consist entirely of ASCII characters, supplied as a byte array.
    default void
    writeCodePoint(int codepoint)
    Process a single character.
    default void
    writeRepeatedAscii(byte asciiChar, int count)
    Process a single character repeatedly.
  • Method Details Link icon

    • write Link icon

      void write(UnicodeString chars) throws IOException
      Process a supplied string
      Parameters:
      chars - the characters to be processed
      Throws:
      IOException - if processing fails for any reason
    • writeAscii Link icon

      void writeAscii(byte[] content) throws IOException
      Write a supplied string known to consist entirely of ASCII characters, supplied as a byte array. (The significance of this is that, for a variety of encodings including UTF-8 and Latin-1, the bytes can be written to the output stream "as is", because many encodings have ASCII as a subset.)
      Parameters:
      content - byte array holding ASCII characters only (the effect if the high-order bit is set is undefined)
      Throws:
      IOException - if processing fails for any reason
    • writeCodePoint Link icon

      default void writeCodePoint(int codepoint) throws IOException
      Process a single character. The default implementation wraps the codepoint into a single-character UnicodeString
      Parameters:
      codepoint - the character to be processed. Must not be a surrogate
      Throws:
      IOException - if processing fails for any reason
    • writeRepeatedAscii Link icon

      default void writeRepeatedAscii(byte asciiChar, int count) throws IOException
      Process a single character repeatedly. The default implementation fills a byte array and calls writeAscii(byte[]).
      Parameters:
      asciiChar - the character to be processed.
      count - the number of times the character is to be output
      Throws:
      IOException - if processing fails for any reason
    • write Link icon

      void write(String chars) throws IOException
      Process a supplied string
      Parameters:
      chars - the characters to be processed
      Throws:
      IOException - if processing fails for any reason
    • close Link icon

      default void close() throws IOException
      Complete the writing of characters to the result. The default implementation does nothing.
      Throws:
      IOException - if processing fails for any reason
    • flush Link icon

      default void flush() throws IOException
      Flush the contents of any buffers. The default implementation does nothing.
      Throws:
      IOException - if processing fails for any reason