SteamWar/SpigotCore
Archiviert
13
0

Merge pull request 'Streaming replay' (#122) from streamReplay into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #122
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2021-10-24 19:38:09 +02:00
Commit c07431a85e

Datei anzeigen

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