Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;

import static org.msgpack.core.Preconditions.checkNotNull;

Expand All @@ -18,7 +19,10 @@ public class InputStreamBufferInput implements MessageBufferInput {
public static MessageBufferInput newBufferInput(InputStream in) {
checkNotNull(in, "InputStream is null");
if (in instanceof FileInputStream) {
return new ChannelBufferInput(((FileInputStream) in).getChannel());
FileChannel channel = ((FileInputStream) in).getChannel();
if(channel != null) {
return new ChannelBufferInput(channel);
}
}
return new InputStreamBufferInput(in);
}
Expand Down