File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
msgpack-core/src/main/java/org/msgpack/core/buffer Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 33import java .io .FileInputStream ;
44import java .io .IOException ;
55import java .io .InputStream ;
6+ import java .nio .channels .FileChannel ;
67
78import static org .msgpack .core .Preconditions .checkNotNull ;
89
@@ -18,7 +19,10 @@ public class InputStreamBufferInput implements MessageBufferInput {
1819 public static MessageBufferInput newBufferInput (InputStream in ) {
1920 checkNotNull (in , "InputStream is null" );
2021 if (in instanceof FileInputStream ) {
21- return new ChannelBufferInput (((FileInputStream ) in ).getChannel ());
22+ FileChannel channel = ((FileInputStream ) in ).getChannel ();
23+ if (channel != null ) {
24+ return new ChannelBufferInput (channel );
25+ }
2226 }
2327 return new InputStreamBufferInput (in );
2428 }
You can’t perform that action at this time.
0 commit comments