public static final class CapturingOutputStream.Config.Builder extends Object
capturing output stream configurations
.Modifier and Type | Method and Description |
---|---|
CapturingOutputStream.Config |
build()
Creates a new
capturing output stream configuration with the settings from this builder. |
CapturingOutputStream.Config.Builder |
onDone(Consumer<? super CapturingOutputStream> callback)
Sets a callback that will be triggered when reading from built capturing output streams is done.
|
CapturingOutputStream.Config.Builder |
onError(BiConsumer<? super CapturingOutputStream,? super IOException> callback)
Sets a callback that will be triggered when an
IOException occurs while using built capturing output streams. |
CapturingOutputStream.Config.Builder |
onLimitReached(Consumer<? super CapturingOutputStream> callback)
Sets a callback that will be triggered when built capturing output streams hit their limit.
|
CapturingOutputStream.Config.Builder |
withExpectedCount(int expectedCount)
Sets the expected number of bytes that can be written to the wrapped output stream.
|
CapturingOutputStream.Config.Builder |
withLimit(int limit)
Sets the maximum number of bytes to capture.
|
public CapturingOutputStream.Config.Builder withLimit(int limit)
Integer.MAX_VALUE
.limit
- The maximum number of bytes to capture.IllegalArgumentException
- If the given limit is negative.public CapturingOutputStream.Config.Builder withExpectedCount(int expectedCount)
-1
.expectedCount
- The expected number of bytes that can be written to the wrapped output stream, or a negative number if not known.public CapturingOutputStream.Config.Builder onDone(Consumer<? super CapturingOutputStream> callback)
closed
or because it has been explicitly marked as
done
. A capturing output stream will only trigger its callback once.callback
- The callback to set.NullPointerException
- If the given callback is null
.public CapturingOutputStream.Config.Builder onLimitReached(Consumer<? super CapturingOutputStream> callback)
callback
- The callback to set.NullPointerException
- If the given callback is null
.public CapturingOutputStream.Config.Builder onError(BiConsumer<? super CapturingOutputStream,? super IOException> callback)
IOException
occurs while using built capturing output streams.
A capturing output stream can trigger its error callback multiple times.callback
- The callback to set.NullPointerException
- If the given callback is null
.public CapturingOutputStream.Config build()
capturing output stream configuration
with the settings from this builder.Copyright © 2020–2024. All rights reserved.