aboutsummaryrefslogtreecommitdiffstats
path: root/poi-scratchpad
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2024-06-05 16:31:36 +0000
committerPJ Fanning <fanningpj@apache.org>2024-06-05 16:31:36 +0000
commitf56eea8e45522cb497074ba9861f523705a9c7f2 (patch)
tree7082e9f09e65197934721051d6fc75e39516b0f8 /poi-scratchpad
parent160fc0122c77bb2594495b832286220e07ac736f (diff)
downloadpoi-f56eea8e45522cb497074ba9861f523705a9c7f2.tar.gz
poi-f56eea8e45522cb497074ba9861f523705a9c7f2.zip
BoundedInputStream deprecation warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918175 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad')
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java
index 2849601612..dfff540574 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java
@@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Supplier;
@@ -102,13 +103,21 @@ public class ExOleObjStg extends PositionDependentRecordAtom implements PersistR
* Opens an input stream which will decompress the data on the fly.
*
* @return the data input stream.
+ * @throws UncheckedIOException if the data size exceeds the expected size.
*/
public InputStream getData() {
if (isCompressed()) {
int size = LittleEndian.getInt(_data);
InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length);
- return new BoundedInputStream(new InflaterInputStream(compressedStream), size);
+ try {
+ return BoundedInputStream.builder()
+ .setInputStream(new InflaterInputStream(compressedStream))
+ .setMaxCount(size)
+ .get();
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
} else {
return new ByteArrayInputStream(_data, 0, _data.length);
}