Streaming replay #122
@ -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);
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren