try {
channel.write(new DefaultFileRegion(fChannel, 0, fChannel.size(), true));
} catch (IOException e) {
// We handle this later
channel.write(new ChunkedStream(new ExceptionInputStream(e)));
}
return;
} else if (in instanceof CombinedInputStream) {
Iterator<InputStream> streams = ((CombinedInputStream) in).iterator();
while(streams.hasNext()) {
InputStream pIn = streams.next();
if (pIn instanceof FileInputStream) {
FileChannel fChannel = ((FileInputStream) in).getChannel();
try {
channel.write(new DefaultFileRegion(fChannel, 0, fChannel.size(), true));
return;
} catch (IOException e) {
// We handle this later
channel.write(new ChunkedStream(new ExceptionInputStream(e)));
}
} else {
channel.write(new ChunkedStream(in));
}
}
return;
}
}
channel.write(new ChunkedStream(in));
}