cleanup crc generator

This commit is contained in:
Adam
2015-10-17 14:17:20 -04:00
parent b21022d207
commit 723a48c903
3 changed files with 15 additions and 19 deletions

View File

@@ -10,7 +10,7 @@ import java.util.Objects;
import net.runelite.cache.fs.io.InputStream;
import net.runelite.cache.fs.io.OutputStream;
import net.runelite.cache.fs.util.BZip2Decompressor;
import net.runelite.cache.fs.util.GZipDecompressor;
import net.runelite.cache.fs.util.GZip;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -302,7 +302,7 @@ public class DataFile implements Closeable
int length = stream.readInt();
data = new byte[length];
revision = this.checkRevision(stream, compressedLength);
GZipDecompressor.decompress(stream, data);
GZip.decompress(stream, data);
}
}

View File

@@ -9,8 +9,6 @@ import java.util.List;
import java.util.Objects;
import net.runelite.cache.fs.io.InputStream;
import net.runelite.cache.fs.io.OutputStream;
import net.runelite.cache.fs.util.BZip2Decompressor;
import net.runelite.cache.fs.util.GZipDecompressor;
public class Index implements Closeable
{

View File

@@ -2,20 +2,18 @@ package net.runelite.cache.fs.util;
import java.util.zip.CRC32;
public final class CRC32HGenerator {
public static final CRC32 CRC32Instance = new CRC32();
public final class CRC32HGenerator
{
public static final CRC32 CRC32Instance = new CRC32();
public static int getHash(byte[] data) {
return getHash(data, 0, data.length);
}
public static int getHash(byte[] data, int offset, int length) {
CRC32 var3 = CRC32Instance;
synchronized(CRC32Instance) {
CRC32Instance.update(data, offset, length);
int hash = (int)CRC32Instance.getValue();
CRC32Instance.reset();
return hash;
}
}
public static int getHash(byte[] data)
{
synchronized (CRC32Instance)
{
CRC32Instance.update(data, 0, data.length);
int hash = (int) CRC32Instance.getValue();
CRC32Instance.reset();
return hash;
}
}
}