Package net.sf.saxon.str
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
Modifier and TypeMethodDescriptiondefault void
close()
Complete the writing of characters to the result.default void
flush()
Flush the contents of any buffers.void
Process a supplied stringvoid
write
(UnicodeString chars) Process a supplied stringvoid
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
-
write
Process a supplied string- Parameters:
chars
- the characters to be processed- Throws:
IOException
- if processing fails for any reason
-
writeAscii
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
Process a single character. The default implementation wraps the codepoint into a single-characterUnicodeString
- Parameters:
codepoint
- the character to be processed. Must not be a surrogate- Throws:
IOException
- if processing fails for any reason
-
writeRepeatedAscii
Process a single character repeatedly. The default implementation fills a byte array and callswriteAscii(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
Process a supplied string- Parameters:
chars
- the characters to be processed- Throws:
IOException
- if processing fails for any reason
-
close
Complete the writing of characters to the result. The default implementation does nothing.- Throws:
IOException
- if processing fails for any reason
-
flush
Flush the contents of any buffers. The default implementation does nothing.- Throws:
IOException
- if processing fails for any reason
-