Package net.sf.saxon.str
Interface UnicodeWriter
-
- All Known Implementing Classes:
UnicodeBuilder
,UnicodeWriterToWriter
,UTF8Writer
public interface UnicodeWriter
Interface that accepts strings in the form ofUnicodeString
objects, which are written to some destination. It also accepts ordinaryString
objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Complete the writing of characters to the result.default void
flush()
Flush the contents of any buffers.void
write(java.lang.String chars)
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 Detail
-
write
void write(UnicodeString chars) throws java.io.IOException
Process a supplied string- Parameters:
chars
- the characters to be processed- Throws:
java.io.IOException
- if processing fails for any reason
-
writeAscii
void writeAscii(byte[] content) throws java.io.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:
java.io.IOException
- if processing fails for any reason
-
writeCodePoint
default void writeCodePoint(int codepoint) throws java.io.IOException
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:
java.io.IOException
- if processing fails for any reason
-
writeRepeatedAscii
default void writeRepeatedAscii(byte asciiChar, int count) throws java.io.IOException
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:
java.io.IOException
- if processing fails for any reason
-
write
void write(java.lang.String chars) throws java.io.IOException
Process a supplied string- Parameters:
chars
- the characters to be processed- Throws:
java.io.IOException
- if processing fails for any reason
-
close
default void close() throws java.io.IOException
Complete the writing of characters to the result. The default implementation does nothing.- Throws:
java.io.IOException
- if processing fails for any reason
-
flush
default void flush() throws java.io.IOException
Flush the contents of any buffers. The default implementation does nothing.- Throws:
java.io.IOException
- if processing fails for any reason
-
-