public final class UTF8Writer extends java.io.Writer implements UnicodeWriter
Constructor and Description |
---|
UTF8Writer(java.io.OutputStream out) |
UTF8Writer(java.io.OutputStream out,
int bufferLength) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Complete the writing of characters to the result.
|
void |
flush()
Flush the contents of any buffers.
|
void |
write(char[] cbuf) |
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int c)
Write a single char.
|
void |
write(java.lang.String str)
Process a supplied string
|
void |
write(java.lang.String str,
int off,
int len) |
void |
write(UnicodeString chars)
Process a supplied string
|
void |
writeAscii(byte[] content)
Write a sequence of ASCII characters.
|
void |
writeAscii(byte[] chars,
int off,
int len)
Write a sequence of ASCII characters.
|
void |
writeCodePoint(int codepoint)
Process a single character.
|
void |
writeLatin1(byte[] bytes,
int off,
int len) |
void |
writeRepeatedAscii(byte ch,
int repeat)
Write an ASCII character repeatedly.
|
public UTF8Writer(java.io.OutputStream out)
public UTF8Writer(java.io.OutputStream out, int bufferLength)
public void close() throws java.io.IOException
UnicodeWriter
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface UnicodeWriter
close
in class java.io.Writer
java.io.IOException
- if processing fails for any reasonpublic void flush() throws java.io.IOException
UnicodeWriter
flush
in interface java.io.Flushable
flush
in interface UnicodeWriter
flush
in class java.io.Writer
java.io.IOException
- if processing fails for any reasonpublic void write(char[] cbuf) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void writeLatin1(byte[] bytes, int off, int len) throws java.io.IOException
java.io.IOException
public void writeAscii(byte[] content) throws java.io.IOException
writeAscii
in interface UnicodeWriter
content
- the content to be writtenjava.io.IOException
- if processing fails for any reasonpublic void writeAscii(byte[] chars, int off, int len) throws java.io.IOException
chars
- the characters to be writtenoff
- the offset of the first character to be includedlen
- the number of characters to be writtenjava.io.IOException
public void writeRepeatedAscii(byte ch, int repeat) throws java.io.IOException
writeRepeatedAscii
in interface UnicodeWriter
ch
- the ASCII character to be serialized (must be less than 0x7f)repeat
- the number of occurrences to outputjava.io.IOException
- if it failspublic void writeCodePoint(int codepoint) throws java.io.IOException
UnicodeString
writeCodePoint
in interface UnicodeWriter
codepoint
- the character to be processed. Must not be a surrogatejava.io.IOException
- if processing fails for any reasonpublic void write(int c) throws java.io.IOException
Note (MHK) Although the Writer interface says that the top half of the int is ignored, this implementation appears to accept a Unicode codepoint which is output as a 4-byte UTF-8 sequence.
write
in class java.io.Writer
c
- the char to be writtenjava.io.IOException
- If an I/O error occurspublic void write(UnicodeString chars) throws java.io.IOException
write
in interface UnicodeWriter
chars
- the characters to be processedjava.io.IOException
- if processing fails for any reasonpublic void write(java.lang.String str) throws java.io.IOException
UnicodeWriter
write
in interface UnicodeWriter
write
in class java.io.Writer
str
- the characters to be processedjava.io.IOException
- if processing fails for any reasonpublic void write(java.lang.String str, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.