I have a try-with-resources block:
try (InputStream stream = file.getValueAs(InputStream.class);
InputStream newstream =
new LimitedSizeInputStream(stream, MAX_FILE_SIZE_IN_BYTES))
{
// some logic... btw I defined LimitedSizeInputStream class with a close method
}
and I'm just wondering if I can change it to
try (InputStream newstream =
new LimitedSizeInputStream(file.getValueAs(InputStream.class), MAX_FILE_SIZE_IN_BYTES))
{
// some logic... btw I defined LimitedSizeInputStream class with a close method
}
Will it behave the same way and close both input streams? Or will there be a difference?