diff options
Diffstat (limited to 'src/main/java/org/bouncycastle/asn1/StreamUtil.java')
-rw-r--r-- | src/main/java/org/bouncycastle/asn1/StreamUtil.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/bouncycastle/asn1/StreamUtil.java b/src/main/java/org/bouncycastle/asn1/StreamUtil.java index 0a3c4aa4..b6cb0706 100644 --- a/src/main/java/org/bouncycastle/asn1/StreamUtil.java +++ b/src/main/java/org/bouncycastle/asn1/StreamUtil.java @@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.channels.FileChannel; class StreamUtil { @@ -33,7 +34,8 @@ class StreamUtil { try { - long size = ((FileInputStream)in).getChannel().size(); + FileChannel channel = ((FileInputStream)in).getChannel(); + long size = (channel != null) ? channel.size() : Integer.MAX_VALUE; if (size < Integer.MAX_VALUE) { |