我有一个方法
public void put(@Nonnull final InputStream inputStream, @Nonnull final String uniqueId) throws PersistenceException {
// a.) create gzip of inputStream
final GZIPInputStream zipInputStream;
try {
zipInputStream = new GZIPInputStream(inputStream);
} catch (IOException e) {
e.printStackTrace();
throw new PersistenceException("Persistence Service could not received input stream to persist for " + uniqueId);
}
我想将其转换inputStream
为zipInputStream
,这样做的方法是什么?
- 上述方法不正确并抛出异常为“不是 Zip 格式”
将 Java Streams 转换为我真的很困惑,我没有让它们正确