|
|
@ -98,8 +98,7 @@ final class SizeCalculatingEntryWriter implements EntryWriter {
|
|
|
|
|
|
|
|
|
|
|
|
private OutputStream outputStream;
|
|
|
|
private OutputStream outputStream;
|
|
|
|
|
|
|
|
|
|
|
|
SizeCalculatingOutputStream() throws IOException {
|
|
|
|
SizeCalculatingOutputStream() {
|
|
|
|
this.tempFile = File.createTempFile("springboot-", "-entrycontent");
|
|
|
|
|
|
|
|
this.outputStream = new ByteArrayOutputStream();
|
|
|
|
this.outputStream = new ByteArrayOutputStream();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -119,11 +118,19 @@ final class SizeCalculatingEntryWriter implements EntryWriter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private OutputStream convertToFileOutputStream(ByteArrayOutputStream byteArrayOutputStream) throws IOException {
|
|
|
|
private OutputStream convertToFileOutputStream(ByteArrayOutputStream byteArrayOutputStream) throws IOException {
|
|
|
|
|
|
|
|
initializeTempFile();
|
|
|
|
FileOutputStream fileOutputStream = new FileOutputStream(this.tempFile);
|
|
|
|
FileOutputStream fileOutputStream = new FileOutputStream(this.tempFile);
|
|
|
|
StreamUtils.copy(byteArrayOutputStream.toByteArray(), fileOutputStream);
|
|
|
|
StreamUtils.copy(byteArrayOutputStream.toByteArray(), fileOutputStream);
|
|
|
|
return fileOutputStream;
|
|
|
|
return fileOutputStream;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initializeTempFile() throws IOException {
|
|
|
|
|
|
|
|
if (this.tempFile == null) {
|
|
|
|
|
|
|
|
this.tempFile = File.createTempFile("springboot-", "-entrycontent");
|
|
|
|
|
|
|
|
this.tempFile.deleteOnExit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void close() throws IOException {
|
|
|
|
public void close() throws IOException {
|
|
|
|
this.outputStream.close();
|
|
|
|
this.outputStream.close();
|
|
|
|