Skip to content
Snippets Groups Projects
Commit 16ade051 authored by OZGCloud's avatar OZGCloud
Browse files

Merge branch 'master' into Version-2

# Conflicts:
#	kop-common-dependencies/pom.xml
#	kop-common-parent/pom.xml
parents 3fee455a 9f21de34
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,14 @@ ...@@ -100,6 +100,14 @@
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>
......
package de.itvsh.kop.common.binaryfile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import lombok.SneakyThrows;
public class FileDataDeserializer extends StdDeserializer<File> {
protected FileDataDeserializer() {
super(File.class);
}
@SneakyThrows
@Override
public File deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JacksonException {
var tempFile = TempFileUtils.createTmpFile();
try (var out = new FileOutputStream(tempFile.toFile())) {
p.readBinaryValue(out);
out.flush();
}
return tempFile.toFile();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment