aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-04 09:26:43 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-04 09:26:43 -0700
commit0112af2cf93743b2bcec0e16cd0d95bcc9713f3f (patch)
treeee10c2572f926da6ffc04d08ee0dee494c41a610 /src/main/java/org/traccar/database
parentaa032baf7349d103cbb3592cfe08a5a0b45a1ff3 (diff)
downloadtrackermap-server-0112af2cf93743b2bcec0e16cd0d95bcc9713f3f.tar.gz
trackermap-server-0112af2cf93743b2bcec0e16cd0d95bcc9713f3f.tar.bz2
trackermap-server-0112af2cf93743b2bcec0e16cd0d95bcc9713f3f.zip
Add device image upload
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/MediaManager.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/database/MediaManager.java b/src/main/java/org/traccar/database/MediaManager.java
index 5f3fdcdf7..2b3e3e1ee 100644
--- a/src/main/java/org/traccar/database/MediaManager.java
+++ b/src/main/java/org/traccar/database/MediaManager.java
@@ -25,6 +25,7 @@ import javax.inject.Inject;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
@@ -53,6 +54,10 @@ public class MediaManager {
return filePath.toFile();
}
+ public OutputStream createFileStream(String uniqueId, String name, String extension) throws IOException {
+ return new FileOutputStream(createFile(uniqueId, name + "." + extension));
+ }
+
public String writeFile(String uniqueId, ByteBuf buf, String extension) {
if (path != null) {
int size = buf.readableBytes();