Closed idozorenko closed 5 years ago
Why someone would want not to flush "automatically"?
I solved this by wrapping the stream provided by getMultiPartOutputStreams
with a FilterOutputStream
like this:
final class CheckedMultipartOutputStream
extends FilterOutputStream {
CheckedMultipartOutputStream(final OutputStream out) {
super(out);
}
@Override
@SneakyThrows
public void write(final byte[] b)
throws IOException {
super.write(b);
out().checkSize();
}
....
Thanks guys, and sorry I never responded to this. There was a time when I thought that checkSize being called too eagerly could lead to malformed data, that was a mistake. I have released a version 2.0 in which the method is no longer public and is called automatically.
Adds optional auto-flush possibility, so as checkSize() does not have to be called manually.