From a369ebccf75db47da3404a4391b652afb5c08531 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 20 Jul 2019 14:56:32 -0500 Subject: [PATCH] Fix compile errors --- .../geysermc/connector/utils/NibbleArray.java | 129 ------------------ 1 file changed, 129 deletions(-) delete mode 100644 connector/src/main/java/org/geysermc/connector/utils/NibbleArray.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/NibbleArray.java b/connector/src/main/java/org/geysermc/connector/utils/NibbleArray.java deleted file mode 100644 index 85be81f8..00000000 --- a/connector/src/main/java/org/geysermc/connector/utils/NibbleArray.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.geysermc.connector.utils; - -import com.google.common.base.Preconditions; - - - -public class NibbleArray implements Cloneable { - - private final byte[] data; - - - - public NibbleArray(int length) { - - data = new byte[length / 2]; - - } - - - - public NibbleArray(byte[] array) { - - data = array; - - } - - - - public byte get(int index) { - - Preconditions.checkElementIndex(index, data.length * 2); - - byte val = data[index / 2]; - - if ((index & 1) == 0) { - - return (byte) (val & 0x0f); - - } else { - - return (byte) ((val & 0xf0) >>> 4); - - } - - } - - - - public void set(int index, byte value) { - - Preconditions.checkArgument(value >= 0 && value < 16, "Nibbles must have a value between 0 and 15."); - - Preconditions.checkElementIndex(index, data.length * 2); - - value &= 0xf; - - int half = index / 2; - - byte previous = data[half]; - - if ((index & 1) == 0) { - - data[half] = (byte) (previous & 0xf0 | value); - - } else { - - data[half] = (byte) (previous & 0x0f | value << 4); - - } - - } - - - - public void fill(byte value) { - - Preconditions.checkArgument(value >= 0 && value < 16, "Nibbles must have a value between 0 and 15."); - - value &= 0xf; - - for (int i = 0; i < data.length; i++) { - - data[i] = (byte) ((value << 4) | value); - - } - - } - - - - public void copyFrom(byte[] bytes) { - - Preconditions.checkNotNull(bytes, "bytes"); - - Preconditions.checkArgument(bytes.length == data.length, "length of provided byte array is %s but expected %s", bytes.length, - - data.length); - - System.arraycopy(bytes, 0, data, 0, data.length); - - } - - - - public void copyFrom(NibbleArray array) { - - Preconditions.checkNotNull(array, "array"); - - copyFrom(array.data); - - } - - - - public byte[] getData() { - - return data; - - } - - - - public NibbleArray copy() { - - return new NibbleArray(getData().clone()); - - } - -} \ No newline at end of file