switch to lz4 block compression

This commit is contained in:
CrazyDev22
2023-12-22 16:13:57 +01:00
parent 4f888f16bc
commit a28df78792
2 changed files with 5 additions and 4 deletions
@@ -110,7 +110,7 @@ public class Mantle {
* @return the file * @return the file
*/ */
public static File fileForRegion(File folder, Long key) { public static File fileForRegion(File folder, Long key) {
File f = new File(folder, "p." + key + ".ttp.lz4"); File f = new File(folder, "p." + key + ".ttp.lz4b");
if (!f.getParentFile().exists()) { if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs(); f.getParentFile().mkdirs();
} }
@@ -552,7 +552,7 @@ public class Mantle {
File file = fileForRegion(dataFolder, x, z); File file = fileForRegion(dataFolder, x, z);
if (!file.exists()) if (!file.exists())
file = new File(dataFolder, file.getName().substring(".lz4".length())); file = new File(dataFolder, file.getName().substring(".lz4b".length()));
if (file.exists()) { if (file.exists()) {
try { try {
@@ -27,6 +27,7 @@ import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.scheduling.PrecisionStopwatch; import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import lombok.Getter; import lombok.Getter;
import net.jpountz.lz4.LZ4BlockInputStream; import net.jpountz.lz4.LZ4BlockInputStream;
import net.jpountz.lz4.LZ4BlockOutputStream;
import net.jpountz.lz4.LZ4FrameInputStream; import net.jpountz.lz4.LZ4FrameInputStream;
import net.jpountz.lz4.LZ4FrameOutputStream; import net.jpountz.lz4.LZ4FrameOutputStream;
@@ -87,7 +88,7 @@ public class TectonicPlate {
GZIPInputStream gzi = new GZIPInputStream(fin); GZIPInputStream gzi = new GZIPInputStream(fin);
din = new DataInputStream(gzi); din = new DataInputStream(gzi);
} else { } else {
LZ4FrameInputStream lz4 = new LZ4FrameInputStream(fin); LZ4BlockInputStream lz4 = new LZ4BlockInputStream(fin);
din = new DataInputStream(lz4); din = new DataInputStream(lz4);
} }
TectonicPlate p = new TectonicPlate(worldHeight, din); TectonicPlate p = new TectonicPlate(worldHeight, din);
@@ -178,7 +179,7 @@ public class TectonicPlate {
GZIPOutputStream gzo = new GZIPOutputStream(fos); GZIPOutputStream gzo = new GZIPOutputStream(fos);
dos = new DataOutputStream(gzo); dos = new DataOutputStream(gzo);
} else { } else {
LZ4FrameOutputStream lz4 = new LZ4FrameOutputStream(fos); LZ4BlockOutputStream lz4 = new LZ4BlockOutputStream(fos);
dos = new DataOutputStream(lz4); dos = new DataOutputStream(lz4);
} }
write(dos); write(dos);