I'm trying to use ProgressBar.warp() to show progress on a FileInputStream, but it will not detect the size of the stream unless I first set some initial size.
This is the current ProgressBar0.9.3 implementation:
public static InputStream wrap(InputStream is, ProgressBarBuilder pbb) {
long size = Util.getInputStreamSize(is);
if (size != -1 && pbb.initialMaxIsSet())
pbb.setInitialMax(size);
return new ProgressBarWrappedInputStream(is, pbb.build());
}
Even if the InputStream size gets detected correctly, it will not use that information.
Behaviour (should):
Use value set by user
(else) Use auto-detected value
(else) Use default value
Behaviour (is)
Ignore value set by user and use auto-detected value
(else) Use default value
The comparison should be !pbb.initialMaxIsSet() instead of pbb.initialMaxIsSet().
This code will not detect the correct file size:
ProgressBar.wrap(is, new ProgressBarBuilder());
This code will detect the correct file size:
ProgressBar.wrap(is, new ProgressBarBuilder().setInitialMax(123456));
Having to set a value which gets ignored is not intuitive.
I'm trying to use
ProgressBar.warp()
to show progress on aFileInputStream
, but it will not detect the size of the stream unless I first set some initial size.This is the current
ProgressBar
0.9.3
implementation:Even if the
InputStream
size gets detected correctly, it will not use that information.Behaviour (should):
Behaviour (is)
The comparison should be
!pbb.initialMaxIsSet()
instead ofpbb.initialMaxIsSet()
.This code will not detect the correct file size:
This code will detect the correct file size:
Having to set a value which gets ignored is not intuitive.