diff --git a/src/main/kotlin/no/nav/klage/service/VedleggService.kt b/src/main/kotlin/no/nav/klage/service/VedleggService.kt index 0fb1835b..3fecd106 100644 --- a/src/main/kotlin/no/nav/klage/service/VedleggService.kt +++ b/src/main/kotlin/no/nav/klage/service/VedleggService.kt @@ -76,19 +76,19 @@ class VedleggService( if (!item.isFormField) { filename = item.name try { -// timeStart = System.currentTimeMillis() -// inputStream.use { input -> -// filePath.outputStream().use { output -> -// input.copyTo(output, 32 * 1024) -// } -// } -// logger.debug("Copied file to temp file in {} ms", System.currentTimeMillis() - timeStart) - timeStart = System.currentTimeMillis() inputStream.use { input -> - output = input.readBytes() + filePath.outputStream().use { output -> + input.copyTo(output, 32 * 1024) + } } - logger.debug("Copied file to byte array in {} ms", System.currentTimeMillis() - timeStart) + logger.debug("Copied file to temp file in {} ms", System.currentTimeMillis() - timeStart) + +// timeStart = System.currentTimeMillis() +// inputStream.use { input -> +// output = input.readBytes() +// } +// logger.debug("Copied file to byte array in {} ms", System.currentTimeMillis() - timeStart) } catch (e: Exception) { throw RuntimeException("Failed to save file", e) } finally {