- java.lang.Object
-
- java.io.Writer
-
- com.aoapps.lang.io.WriterFacade
-
- All Implemented Interfaces:
NoClose,Closeable,Flushable,Appendable,AutoCloseable
public final class WriterFacade extends Writer implements NoClose
Wraps a writer while passing-through all methods of the writer class. This is used to hide the implementation of writer from calling classes.- Author:
- AO Industries, Inc.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WriterFacadeappend(char c)WriterFacadeappend(CharSequence csq)WriterFacadeappend(CharSequence csq, int start, int end)voidclose()Calls to close are ignored whenNoClose.isNoClose(), otherwise some action might be taken which means close calls to this object may not be skipped or assumed to be ignored.voidflush()static WriterFacadegetInstance(Writer out)Gets an instance of the WriterFacade that wraps the given Writer.booleanisNoClose()Determines if calls toNoClose.close()will be ignored.voidwrite(char[] cbuf)voidwrite(char[] cbuf, int off, int len)voidwrite(int c)voidwrite(String str)voidwrite(String str, int off, int len)-
Methods inherited from class java.io.Writer
nullWriter
-
-
-
-
Method Detail
-
getInstance
public static WriterFacade getInstance(Writer out)
Gets an instance of the WriterFacade that wraps the given Writer. If the provided writer is already a WriterFacade, returns it without additional wrapping.
-
write
public void write(int c) throws IOException- Overrides:
writein classWriter- Throws:
IOException
-
write
public void write(char[] cbuf) throws IOException- Overrides:
writein classWriter- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) throws IOException- Specified by:
writein classWriter- Throws:
IOException
-
write
public void write(String str) throws IOException
- Overrides:
writein classWriter- Throws:
IOException
-
write
public void write(String str, int off, int len) throws IOException
- Overrides:
writein classWriter- Throws:
IOException
-
append
public WriterFacade append(CharSequence csq) throws IOException
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
public WriterFacade append(CharSequence csq, int start, int end) throws IOException
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
public WriterFacade append(char c) throws IOException
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
isNoClose
public boolean isNoClose()
Description copied from interface:NoCloseDetermines if calls toNoClose.close()will be ignored. This value must not change over time; it may be queried once, repeatedly, or never.
-
close
public void close() throws IOExceptionDescription copied from interface:NoCloseCalls to close are ignored whenNoClose.isNoClose(), otherwise some action might be taken which means close calls to this object may not be skipped or assumed to be ignored.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceNoClose- Specified by:
closein classWriter- Throws:
IOException
-
-