public final class BufferingWriter extends Writer
The java.io classes have hidden synchronization so in some very critical situations, this can be expensive (such situations are not common). This class generalises the notion of destination via the Sink abstraction (block output based on ByteBuffers).
This class is not thread safe.PeekReader| Modifier and Type | Class and Description |
|---|---|
static class |
BufferingWriter.SinkBuffer |
static class |
BufferingWriter.SinkChannel |
static class |
BufferingWriter.SinkOutputStream |
| Constructor and Description |
|---|
BufferingWriter(Sink<ByteBuffer> sink)
Create a buffering output stream of charcaters to a
Sink |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
void |
output(char[] chars)
Output an array of characters
|
void |
output(char[] chars,
int start,
int finish)
Output an array of characters
|
void |
output(CharSequence string)
Output characters (The String class implements CharSequence)
|
void |
output(int ch)
Output a single character
|
void |
write(char[] cbuf) |
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int ch) |
void |
write(String string) |
public BufferingWriter(Sink<ByteBuffer> sink)
Sinkpublic void output(CharSequence string)
public void output(char[] chars)
public void output(char[] chars,
int start,
int finish)
chars - Charactersstart - Start (inclusive)finish - Finish (exclusive)public void output(int ch)
public void close()
public void flush()
public void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOExceptionpublic void write(char[] cbuf)
throws IOException
write in class WriterIOExceptionpublic void write(String string) throws IOException
write in class WriterIOExceptionpublic void write(int ch)
throws IOException
write in class WriterIOExceptionLicenced under the Apache License, Version 2.0