public class UTF8StreamWriter
extends java.io.Writer
Constructor and Description |
---|
UTF8StreamWriter(java.io.OutputStream out)
Create a UTF8StreamWriter around the specified OutputStream.
|
Modifier and Type | Method and Description |
---|---|
java.io.Writer |
append(char c)
Appends the specified character to this writer.
|
void |
close()
Closes the stream, flushing it first.
|
void |
flush()
Flushes the stream.
|
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
void |
write(int c)
Writes a single character.
|
void |
write(java.lang.String str,
int off,
int len)
Writes a portion of a string.
|
public UTF8StreamWriter(java.io.OutputStream out)
out
- OutputStream to feed UTF-8 encoded datapublic void write(int c) throws java.io.IOException
write
in class java.io.Writer
c
- int specifying a character to be writtenjava.io.IOException
- If an I/O error occurspublic java.io.Writer append(char c) throws java.io.IOException
An invocation of this method of the form out.append(c)
behaves in exactly the same way as the invocation
out.write(c)
append
in interface java.lang.Appendable
append
in class java.io.Writer
c
- The 16-bit character to appendjava.io.IOException
- If an I/O error occurspublic void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writejava.io.IOException
- If an I/O error occurspublic void write(java.lang.String str, int off, int len) throws java.io.IOException
write
in class java.io.Writer
str
- A Stringoff
- Offset from which to start writing characterslen
- Number of characters to writejava.lang.IndexOutOfBoundsException
- If off
is negative, or len
is negative,
or off+len
is negative or greater than the length
of the given stringjava.io.IOException
- If an I/O error occurspublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
- If an I/O error occurspublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
- If an I/O error occurs