We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7cd8f41 commit 3dbe178Copy full SHA for 3dbe178
1 file changed
msgpack-core/src/main/java/org/msgpack/core/buffer/InputStreamBufferInput.java
@@ -3,6 +3,7 @@
3
import java.io.FileInputStream;
4
import java.io.IOException;
5
import java.io.InputStream;
6
+import java.nio.channels.FileChannel;
7
8
import static org.msgpack.core.Preconditions.checkNotNull;
9
@@ -18,7 +19,10 @@ public class InputStreamBufferInput implements MessageBufferInput {
18
19
public static MessageBufferInput newBufferInput(InputStream in) {
20
checkNotNull(in, "InputStream is null");
21
if (in instanceof FileInputStream) {
- return new ChannelBufferInput(((FileInputStream) in).getChannel());
22
+ FileChannel channel = ((FileInputStream) in).getChannel();
23
+ if(channel != null) {
24
+ return new ChannelBufferInput(channel);
25
+ }
26
}
27
return new InputStreamBufferInput(in);
28
0 commit comments