SteamWar/SpigotCore
Archiviert
13
0

Streaming replay
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2021-10-24 16:28:36 +02:00
Ursprung feba7b6eaf
Commit 6c19de82e5

Datei anzeigen

@ -23,6 +23,7 @@ import java.io.InputStream;
import java.sql.Blob; import java.sql.Blob;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.function.Consumer;
public class Fight { public class Fight {
private Fight(){} private Fight(){}
@ -44,6 +45,7 @@ public class Fight {
}); });
} }
@Deprecated
public static InputStream getReplay(int fightID) { public static InputStream getReplay(int fightID) {
return getReplay.select(rs -> { return getReplay.select(rs -> {
rs.next(); rs.next();
@ -52,6 +54,15 @@ public class Fight {
}, fightID); }, fightID);
} }
public static void getReplay(int fightID, Consumer<InputStream> reader) {
getReplay.select(rs -> {
rs.next();
reader.accept(rs.getBinaryStream("Replay"));
return null;
}, fightID);
}
@Deprecated
public static void setReplay(int fightID, byte[] data) { public static void setReplay(int fightID, byte[] data) {
Blob blob = SQL.blob(); Blob blob = SQL.blob();
try { try {
@ -61,4 +72,8 @@ public class Fight {
} }
setReplay.update(blob, fightID); setReplay.update(blob, fightID);
} }
public static void setReplay(int fightID, InputStream data) {
setReplay.update(data, fightID);
}
} }