public static class StreamHelper.CopyCharStreamBuilder extends Object implements IBuilder<ESuccess>
from(Reader)) to an Writer
(to(Writer)) with certain parameters. Call build() to
execute the copying.| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_CLOSE_FROM |
static boolean |
DEFAULT_CLOSE_TO |
| Constructor and Description |
|---|
CopyCharStreamBuilder() |
| Modifier and Type | Method and Description |
|---|---|
StreamHelper.CopyCharStreamBuilder |
buffer(char[] a) |
ESuccess |
build()
This method performs the main copying
|
StreamHelper.CopyCharStreamBuilder |
closeFrom(boolean b) |
StreamHelper.CopyCharStreamBuilder |
closeTo(boolean b) |
StreamHelper.CopyCharStreamBuilder |
copyCharCount(MutableLong a) |
StreamHelper.CopyCharStreamBuilder |
exceptionCallback(IExceptionCallback<IOException> a) |
StreamHelper.CopyCharStreamBuilder |
from(Reader a) |
StreamHelper.CopyCharStreamBuilder |
limit(long n) |
StreamHelper.CopyCharStreamBuilder |
limit(Long a) |
StreamHelper.CopyCharStreamBuilder |
to(Writer a) |
StreamHelper.CopyCharStreamBuilder |
unlimited()
Ensure no limit in copying (which is also the default).
|
public static final boolean DEFAULT_CLOSE_FROM
public static final boolean DEFAULT_CLOSE_TO
@Nonnull public StreamHelper.CopyCharStreamBuilder from(@Nullable Reader a)
a - The Reader to read from. May be null.@Nonnull public StreamHelper.CopyCharStreamBuilder closeFrom(boolean b)
b - true to close the Reader, false to leave
it open. Default is DEFAULT_CLOSE_FROM@Nonnull public StreamHelper.CopyCharStreamBuilder to(@Nullable Writer a)
a - The Writer to write to. May be null.@Nonnull public StreamHelper.CopyCharStreamBuilder closeTo(boolean b)
b - true to close the Writer, false to leave
it open.@Nonnull public StreamHelper.CopyCharStreamBuilder buffer(@Nullable char[] a)
a - The buffer to use. May be null.@Nonnull public StreamHelper.CopyCharStreamBuilder limit(long n)
n - An optional maximum number of chars to copied from the Reader to
the Writer. May be < 0 to indicate no limit, meaning all chars
are copied.unlimited()@Nonnull public StreamHelper.CopyCharStreamBuilder limit(@Nullable Long a)
a - An optional maximum number of chars to copied from the InputStream
to the OutputStream. May be < 0 to indicate no limit, meaning
all bytes are copied. If null no limit is setunlimited()@Nonnull public StreamHelper.CopyCharStreamBuilder unlimited()
limit(long)@Nonnull public StreamHelper.CopyCharStreamBuilder exceptionCallback(@Nullable IExceptionCallback<IOException> a)
a - The Exception callback to be invoked, if an exception occurs. May
be null.@Nonnull public StreamHelper.CopyCharStreamBuilder copyCharCount(@Nullable MutableLong a)
a - An optional mutable long object that will receive the total number
of copied chars. Note: and optional old value is overwritten.
Note: this is only called, if copying was successful, and not in
case of an exception.Copyright © 2014–2022 Philip Helger. All rights reserved.