- Type Parameters:
E
- the exception type that can happen on output
- All Known Subinterfaces:
BufferedEncodedOutput
,ByteBufferEncodedOutput
,ChunkEncodedOutput<T>
,LimitEncodedOutput<T,
,E> Output.CloseableEncodedOutput<E>
,Output.EncodedOutput<E>
- All Known Implementing Classes:
ByteBufferedOutputStream
,ForwardingEncodedOutput
,ForwardingOutput
,Output.StringOutput
,ThresholdEncodedOutput
,ThresholdEncodedOutput.OutputStreamThresholdEncodedOutput
A low level abstraction and implementation detail analogous to
Appendable
and
DataOutput
.- Author:
- agentgt
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Output.CloseableEncodedOutput<E extends Exception>
An encoded output that can be closed.static interface
Output.EncodedOutput<E extends Exception>
A specialized Output designed for pre-encoded templates that have already encoded byte arrays to be used directly.static class
String Builder based output. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
append
(boolean b) Write a long by usingString.valueOf(long)
.void
append
(char c) Appends a character to an appendable.default void
append
(double d) Write a long by usingString.valueOf(long)
.default void
append
(int i) Write a int by usingString.valueOf(int)
.default void
append
(long l) Write a long by usingString.valueOf(long)
.default void
append
(short s) Write a short by usingString.valueOf(int)
void
Analogous toAppendable.append(CharSequence)
.void
append
(CharSequence csq, int start, int end) Analogous toAppendable.append(CharSequence, int, int)
.default void
Analogous toAppendable.append(CharSequence)
which by default treats the String as a CharSequence.static Output.EncodedOutput<IOException>
of
(OutputStream a, Charset charset) Adapts anOutputStream
as anOutput
.static Output<IOException>
of
(Appendable a) Adapts anAppendable
as anOutput
.static Output.StringOutput
of
(StringBuilder a) Adapts aStringBuilder
as anOutput
.default Appendable
Converts the output to an appendable unless it already is one.
-
Method Details
-
append
Analogous toAppendable.append(CharSequence)
.- Parameters:
s
- unlike appendable always non null.- Throws:
E
- if an error happens while writting to the appendable- API Note
- Implementations are required to implement this method.
-
append
Analogous toAppendable.append(CharSequence)
which by default treats the String as a CharSequence.- Parameters:
s
- unlike appendable always non null.- Throws:
E
- if an error happens while writting to the appendable- API Note
- Implementations are required to implement this method.
-
append
Analogous toAppendable.append(CharSequence, int, int)
.- Parameters:
csq
- Unlike appendable never null.start
- start inclusiveend
- end exclusive- Throws:
E
- if an error happens while writting to the appendable- API Note
- Implementations are required to implement this method.
-
append
Appends a character to an appendable.- Parameters:
c
- character- Throws:
E
- if an error happens while writting to the appendable- API Note
- Implementations are required to implement this method.
-
append
Write a short by usingString.valueOf(int)
- Parameters:
s
- short- Throws:
E
- if an error happens while writting to the appendable
-
append
Write a int by usingString.valueOf(int)
.Implementations should override if they want different behavior or able to support appendables that can write the native type.
- Parameters:
i
- int- Throws:
E
- if an error happens while writting to the appendable
-
append
Write a long by usingString.valueOf(long)
.Implementations should override if they want different behavior or able to support appendables that can write the native type.
- Parameters:
l
- long- Throws:
E
- if an error happens while writting to the appendable
-
append
Write a long by usingString.valueOf(long)
.Implementations should override if they want different behavior or able to support appendables that can write the native type.
- Parameters:
d
- double- Throws:
E
- if an error happens while writting to the appendable
-
append
Write a long by usingString.valueOf(long)
.Implementations should override if they want different behavior or able to support appendables that can write the native type.
- Parameters:
b
- boolean- Throws:
E
- if an error happens while writting to the appendable
-
of
Adapts anOutputStream
as anOutput
.- Parameters:
a
- the OutputStream to be wrapped.charset
- the encoding to use- Returns:
- outputstream output
-
of
Adapts anAppendable
as anOutput
.- Parameters:
a
- the appendable to be wrapped.- Returns:
- string based output
-
of
Adapts aStringBuilder
as anOutput
.- Parameters:
a
- the StringBuilder to be wrapped.- Returns:
- string based output
-
toAppendable
Converts the output to an appendable unless it already is one.- Returns:
- adapted appendable of this output.
-