Create an input stream from a list of disk ranges with data. @param name the name of the stream @param input the list of ranges of bytes for the stream; from disk or cache @param offset the first byte offset of the stream @param length the length in bytes of the stream @param options the options to
(Object name,
DiskRangeList input,
long offset,
long length,
StreamOptions options)
| 872 | * @return an input stream |
| 873 | */ |
| 874 | public static InStream create(Object name, |
| 875 | DiskRangeList input, |
| 876 | long offset, |
| 877 | long length, |
| 878 | StreamOptions options) { |
| 879 | LOG.debug("Reading {} with {} from {} for {}", name, options, offset, |
| 880 | length); |
| 881 | if (options == null || options.codec == null) { |
| 882 | if (options == null || options.key == null) { |
| 883 | return new UncompressedStream(name, input, offset, length); |
| 884 | } else { |
| 885 | OutStream.logKeyAndIv(name, options.getKey(), options.getIv()); |
| 886 | return new EncryptedStream(name, input, offset, length, options); |
| 887 | } |
| 888 | } else if (options.key == null) { |
| 889 | return new CompressedStream(name, input, offset, length, options); |
| 890 | } else { |
| 891 | OutStream.logKeyAndIv(name, options.getKey(), options.getIv()); |
| 892 | return new EncryptedCompressedStream(name, input, offset, length, options); |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | /** |
| 897 | * Create an input stream from a list of disk ranges with data. |