SteamWar/SpigotCore
Archiviert
13
0

Streaming replay #122

Zusammengeführt
Lixfel hat 1 Commits von streamReplay nach master 2021-10-24 19:38:11 +02:00 zusammengeführt

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);
}
}