Package com.github.marschall.writers
Class AsciiOutputStreamWriter
- java.lang.Object
-
- java.io.Writer
-
- com.github.marschall.writers.AsciiOutputStreamWriter
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
public final class AsciiOutputStreamWriter extends Writer
A writer that encodes to ASCII.For non-ASCII characters
'?'
will be written instead just likeOutputStreamWriter
does.- Implementation Note:
- This class is thread-safe., This writer does not allocate any objects or call methods that allocate objects.
-
-
Constructor Summary
Constructors Constructor Description AsciiOutputStreamWriter(OutputStream out)
Constructs a newAsciiOutputStreamWriter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Writer
append(char c)
Writer
append(CharSequence csq)
Writer
append(CharSequence csq, int start, int end)
void
close()
void
flush()
void
write(char[] cbuf)
void
write(char[] cbuf, int offset, int len)
void
write(int c)
void
write(String s)
void
write(String s, int offset, int len)
-
Methods inherited from class java.io.Writer
nullWriter
-
-
-
-
Constructor Detail
-
AsciiOutputStreamWriter
public AsciiOutputStreamWriter(OutputStream out)
Constructs a newAsciiOutputStreamWriter
- Parameters:
out
- the output stream to delegate to, notnull
- Throws:
NullPointerException
- whenout
isnull
-
-
Method Detail
-
write
public void write(int c) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
public void write(char[] cbuf) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
public void write(char[] cbuf, int offset, int len) throws IOException
- Specified by:
write
in classWriter
- Throws:
IOException
-
write
public void write(String s) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
public void write(String s, int offset, int len) throws IOException
- Overrides:
write
in classWriter
- Throws:
IOException
-
append
public Writer append(CharSequence csq) throws IOException
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Throws:
IOException
-
append
public Writer append(CharSequence csq, int start, int end) throws IOException
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Throws:
IOException
-
append
public Writer append(char c) throws IOException
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-
-