Delete CompressorTest.java

Not needed in final version
This commit is contained in:
Kamron Vaswani authored and GitHub committed 2022-03-03 16:02:02 -05:00
1 parent 3339488a6f
commit 89b7019e29
1 file changed
-77
@@ -1,77 +0,0 @@
package me.luizotavio.compressor;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.util.JsonException;
import noppes.npcs.util.NBTJsonUtil;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
public class CompressorTest {
public static final int MAX_ENTRIES = 1000;
public static void main(String[] args) throws JsonException, IOException {
Logger logger = Logger.getLogger("CompressorTest");
logger.info("Starting CompressorTest with " + MAX_ENTRIES + " entries");
NBTTagCompound compound = new NBTTagCompound();
File file = new File("test.json");
fill(compound);
long start = System.currentTimeMillis();
logger.info("Writing the data into JSON...");
NBTJsonUtil.SaveFile(file, compound);
long end = System.currentTimeMillis();
logger.info("Done! Took " + (end - start) + "ms");
logger.info("Reading the data from JSON...");
start = System.currentTimeMillis();
NBTJsonUtil.LoadFile(new File("test.json"));
end = System.currentTimeMillis();
logger.info("Done! Took " + (end - start) + "ms");
logger.info("Now, we will compress the data into zstd...");
start = System.currentTimeMillis();
byte[] bytes = ZstdCompressor.writeCompound(compound);
end = System.currentTimeMillis();
logger.info("Done! Took " + (end - start) + "ms");
logger.info("Now, we will decompress the data from zstd...");
start = System.currentTimeMillis();
ZstdCompressor.readCompressed(
new DataInputStream(
new ByteArrayInputStream(bytes)
)
);
end = System.currentTimeMillis();
logger.info("Done! Took " + (end - start) + "ms");
file.deleteOnExit();
}
private static void fill(NBTTagCompound compound) {
for (int i = 0; i < MAX_ENTRIES; i++) {
compound.setInteger("" + i, i);
}
}
}