当我编写zipInputStream时在S3中获取0KB文件

时间:2019-10-15 20:22:21

标签: scala stream

我有下面的代码在S3中生成0KB文件,下面的代码有什么问题

def extractFilesFromZipStream(zipInputStream: ZipArchiveInputStream,
                                tgtPath: String, storageType:String): scala.collection.mutable.Map[String, (String, Long)] = {

    var filePathMap = scala.collection.mutable.Map[String, (String, Long)]()
    Try {
      storageWrapper.mkDirs(tgtPath)
      Stream.continually(zipInputStream.getNextZipEntry).takeWhile(_ != null).foreach {file =>

        val storagePathFilePath = s"$tgtPath/${file.getName}"

       storageWrapper.write(zipInputStream, storagePathFilePath)

        LOGGER.info(storagePathFilePath)
        val lineCount = Source.fromInputStream(storageWrapper.read(storagePathFilePath)).getLines().count(s => s!= null)

Storage包装器没有任何问题,它采用了输入流和路径,并且到目前为止运行良好。谁能建议我使用zipArchive Stream的实现有什么问题。

0 个答案:

没有答案