java.lang.Object
java.io.Writer
com.aoapps.lang.io.AppendableWriter
- All Implemented Interfaces:
NoClose,Closeable,Flushable,Appendable,AutoCloseable
Writer that writes to an underlying
Appendable.
This is not necessarily the absolute fastest way to get things done (at least
when a char[] has to be wrapped in a Segment), but can help
bridge the gap between APIs based on Writer and Appendable.- Author:
- AO Industries, Inc.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(CharSequence csq) append(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()getOut()Gets the wrapped appendable.booleanDetermines if calls toNoClose.close()will be ignored.static Writerwrap(Appendable out) Wraps the givenAppendableif it is not already aWriter.voidwrite(char[] cbuf) voidwrite(char[] cbuf, int off, int len) voidwrite(int c) voidvoidMethods inherited from class java.io.Writer
nullWriter
-
Constructor Details
-
AppendableWriter
-
-
Method Details
-
wrap
Wraps the givenAppendableif it is not already aWriter.- Returns:
- The given out, if it is already a
Writer, otherwise anAppendableWriterwrapping out.
-
getOut
Gets the wrapped appendable. -
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
- Specified by:
writein classWriter- Throws:
IOException
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
flush
- 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
Description 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
-
