-1
我正在使用ZipInputStream读取zip文件。 Zip文件有4个csv文件。有些文件是完全写入的,有些是部分写入的。请用下面的代码帮我找到问题。从ZipInputStream.read方法读取缓冲区有没有限制?ZipEntry中的ZipInputStream.read
val zis = new ZipInputStream(inputStream)
Stream.continually(zis.getNextEntry).takeWhile(_ != null).foreach { file =>
if (!file.isDirectory && file.getName.endsWith(".csv")) {
val buffer = new Array[Byte](file.getSize.toInt)
zis.read(buffer)
val fo = new FileOutputStream("c:\\temp\\input\\" + file.getName)
fo.write(buffer)
}