-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)
}