Module io.jstach.jstachio
Package io.jstach.jstachio.output
Class ThresholdEncodedOutput.OutputStreamThresholdEncodedOutput
java.lang.Object
io.jstach.jstachio.output.ThresholdEncodedOutput<OutputStream,IOException>
io.jstach.jstachio.output.ThresholdEncodedOutput.OutputStreamThresholdEncodedOutput
- All Implemented Interfaces:
Output<IOException>
,Output.CloseableEncodedOutput<IOException>
,Output.EncodedOutput<IOException>
,LimitEncodedOutput<OutputStream,
,IOException> AutoCloseable
- Enclosing class:
- ThresholdEncodedOutput<T,
E extends Exception>
public abstract static class ThresholdEncodedOutput.OutputStreamThresholdEncodedOutput
extends ThresholdEncodedOutput<OutputStream,IOException>
An OutputStream backed buffer limited encoded output. This partial implementation
will cascade
ThresholdEncodedOutput.close()
to the OutputStream similar to OutputStream
decorators in the JDK.- Author:
- agentgt
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jstach.jstachio.output.ThresholdEncodedOutput
ThresholdEncodedOutput.OutputStreamThresholdEncodedOutput
Nested classes/interfaces inherited from interface io.jstach.jstachio.Output
Output.CloseableEncodedOutput<E extends Exception>, Output.EncodedOutput<E extends Exception>, Output.StringOutput
-
Field Summary
Fields inherited from class io.jstach.jstachio.output.ThresholdEncodedOutput
limit
-
Constructor Summary
ModifierConstructorDescriptionprotected
OutputStreamThresholdEncodedOutput
(Charset charset, int limit) Create with charset and limit. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
close
(OutputStream consumer) Called to close the consumer.protected void
write
(OutputStream consumer, byte[] bytes) Writes to a consumer.Methods inherited from class io.jstach.jstachio.output.ThresholdEncodedOutput
append, append, charset, close, consumer, createConsumer, limit, size, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jstach.jstachio.Output
append, append, append, append, append, toAppendable
Methods inherited from interface io.jstach.jstachio.Output.EncodedOutput
append, append, write
-
Constructor Details
-
OutputStreamThresholdEncodedOutput
Create with charset and limit.- Parameters:
charset
- the encoding to use.limit
- the amount of total bytes to limit buffering however the total buffered amount of data is not guaranteed to be exactly at the limit even if the total output is greater than the limit.
-
-
Method Details
-
write
Description copied from class:ThresholdEncodedOutput
Writes to a consumer.- Specified by:
write
in classThresholdEncodedOutput<OutputStream,
IOException> - Parameters:
consumer
- the consumer created fromThresholdEncodedOutput.createConsumer(int)
.bytes
- data to be written- Throws:
IOException
-
close
Description copied from class:ThresholdEncodedOutput
Called to close the consumer. Implementations can decide whether or not to really close the consumer.- Specified by:
close
in classThresholdEncodedOutput<OutputStream,
IOException> - Parameters:
consumer
- to be closed or not- Throws:
IOException
-