我从S3获取Zip文件,然后尝试解压缩它。 Zip文件内容: - 测试2文件夹/ abc.log xyz.log
代码
val S3Object = getObject(id.bucketName, id.key_fileName)
val zipStreamm = new ZipInputStream(S3Object.getObjectContent)
val entryStream = Stream.continually(zipStreamm.getNextEntry).takeWhile(x => x != null)
val files: Stream[String] = entryStream.map { _ => scala.io.Source.fromInputStream(zipStreamm).getLines.mkString("\n") }
错误
Mar 10, 2017 12:48:48 AM com.twitter.finagle.Init$ $anonfun$once$1
INFO: Finagle version 6.42.0 (rev=f48520b6809792d8cb87c5d81a13075fd01c051d) built at 20170203-170145
Mar 10, 2017 12:48:50 AM com.twitter.finagle.util.DefaultMonitor logWithRemoteInfo
WARNING: Exception propagated to the default monitor (upstream address: /127.0.0.1:60721, downstream address: n/a, label: ).
java.io.FileNotFoundException: Test 2/abc.log (Not a directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
答案 0 :(得分:0)
正如我从这个例外中看到的那样,您试图在测试2 文件夹中解压缩文件,而不是测试
java.io.FileNotFoundException: Test 2/abc.log (Not a directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
您可以共享执行此操作的代码吗?