Include arm lz4 binding + fix timings recheck
This commit is contained in:
parent
bb92a64be3
commit
b3ee619d70
@ -290,6 +290,7 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
|
|||||||
}
|
}
|
||||||
if (fieldTimingsEnabled != null && timingsEnabled) {
|
if (fieldTimingsEnabled != null && timingsEnabled) {
|
||||||
fieldTimingsEnabled.set(null, true);
|
fieldTimingsEnabled.set(null, true);
|
||||||
|
methodCheck.invoke(null);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -158,8 +158,7 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
|
|||||||
*/
|
*/
|
||||||
public synchronized static AsyncWorld create(final WorldCreator creator) {
|
public synchronized static AsyncWorld create(final WorldCreator creator) {
|
||||||
BukkitQueue_0 queue = (BukkitQueue_0) SetQueue.IMP.getNewQueue(creator.name(), true, false);
|
BukkitQueue_0 queue = (BukkitQueue_0) SetQueue.IMP.getNewQueue(creator.name(), true, false);
|
||||||
World world = queue.createWorld(
|
World world = queue.createWorld(creator);
|
||||||
creator);
|
|
||||||
return wrap(world);
|
return wrap(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,6 +405,8 @@ public class Fawe {
|
|||||||
|
|
||||||
public void setupConfigs() {
|
public void setupConfigs() {
|
||||||
MainUtil.copyFile(MainUtil.getJarFile(), "de/messages.yml", null);
|
MainUtil.copyFile(MainUtil.getJarFile(), "de/messages.yml", null);
|
||||||
|
MainUtil.copyFile(MainUtil.getJarFile(), "ru/messages.yml", null);
|
||||||
|
MainUtil.copyFile(MainUtil.getJarFile(), "ru/commands.yml", null);
|
||||||
// Setting up config.yml
|
// Setting up config.yml
|
||||||
File file = new File(this.IMP.getDirectory(), "config.yml");
|
File file = new File(this.IMP.getDirectory(), "config.yml");
|
||||||
Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", "");
|
Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", "");
|
||||||
|
@ -91,9 +91,11 @@ public class BaseBlock extends Block implements TileEntityBlock, Pattern, Serial
|
|||||||
/**
|
/**
|
||||||
* Construct a block with the given ID and a data value of 0.
|
* Construct a block with the given ID and a data value of 0.
|
||||||
*
|
*
|
||||||
|
* @deprecated see {@link com.boydti.fawe.FaweCache#getBlock(int, int)}
|
||||||
* @param id ID value
|
* @param id ID value
|
||||||
* @see #setId(int)
|
* @see #setId(int)
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public BaseBlock(int id) {
|
public BaseBlock(int id) {
|
||||||
internalSetId(id);
|
internalSetId(id);
|
||||||
internalSetData(0);
|
internalSetData(0);
|
||||||
@ -102,11 +104,13 @@ public class BaseBlock extends Block implements TileEntityBlock, Pattern, Serial
|
|||||||
/**
|
/**
|
||||||
* Construct a block with the given ID and data value.
|
* Construct a block with the given ID and data value.
|
||||||
*
|
*
|
||||||
|
* @deprecated see {@link com.boydti.fawe.FaweCache#getBlock(int, int)}
|
||||||
* @param id ID value
|
* @param id ID value
|
||||||
* @param data data value
|
* @param data data value
|
||||||
* @see #setId(int)
|
* @see #setId(int)
|
||||||
* @see #setData(int)
|
* @see #setData(int)
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public BaseBlock(int id, int data) {
|
public BaseBlock(int id, int data) {
|
||||||
internalSetId(id);
|
internalSetId(id);
|
||||||
internalSetData(data);
|
internalSetData(data);
|
||||||
@ -115,10 +119,12 @@ public class BaseBlock extends Block implements TileEntityBlock, Pattern, Serial
|
|||||||
/**
|
/**
|
||||||
* Construct a block with the given ID, data value and NBT data structure.
|
* Construct a block with the given ID, data value and NBT data structure.
|
||||||
*
|
*
|
||||||
|
* @deprecated see {@link com.boydti.fawe.FaweCache#getBlock(int, int)}
|
||||||
* @param id ID value
|
* @param id ID value
|
||||||
* @param data data value
|
* @param data data value
|
||||||
* @param nbtData NBT data, which may be null
|
* @param nbtData NBT data, which may be null
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public BaseBlock(int id, int data, @Nullable CompoundTag nbtData) {
|
public BaseBlock(int id, int data, @Nullable CompoundTag nbtData) {
|
||||||
setId(id);
|
setId(id);
|
||||||
setData(data);
|
setData(data);
|
||||||
@ -128,8 +134,10 @@ public class BaseBlock extends Block implements TileEntityBlock, Pattern, Serial
|
|||||||
/**
|
/**
|
||||||
* Create a clone of another block.
|
* Create a clone of another block.
|
||||||
*
|
*
|
||||||
|
* @deprecated see {@link com.boydti.fawe.FaweCache#getBlock(int, int)}
|
||||||
* @param other the other block
|
* @param other the other block
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public BaseBlock(BaseBlock other) {
|
public BaseBlock(BaseBlock other) {
|
||||||
this(other.getId(), other.getData(), other.getNbtData());
|
this(other.getId(), other.getData(), other.getNbtData());
|
||||||
}
|
}
|
||||||
|
@ -1,150 +0,0 @@
|
|||||||
package net.jpountz.lz4;
|
|
||||||
|
|
||||||
import com.boydti.fawe.util.MainUtil;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Random;
|
|
||||||
import junit.framework.Assert;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
|
||||||
|
|
||||||
public class LZ4StreamTest {
|
|
||||||
|
|
||||||
private long seed;
|
|
||||||
private Random rand;
|
|
||||||
|
|
||||||
private byte randomContent[];
|
|
||||||
private byte compressedOutput[];
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() throws IOException {
|
|
||||||
seed = System.currentTimeMillis();
|
|
||||||
rand = new Random(seed);
|
|
||||||
|
|
||||||
int randomContentLength = rand.nextInt(10000000) + 10000000;
|
|
||||||
|
|
||||||
randomContent = new byte[randomContentLength];
|
|
||||||
rand.nextBytes(randomContent);
|
|
||||||
|
|
||||||
compressContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void compressContent() throws IOException {
|
|
||||||
ByteArrayOutputStream compressedOutputStream = new ByteArrayOutputStream();
|
|
||||||
|
|
||||||
LZ4OutputStream os = new LZ4OutputStream(compressedOutputStream);
|
|
||||||
int currentContentPosition = 0;
|
|
||||||
|
|
||||||
while(currentContentPosition < randomContent.length) {
|
|
||||||
int testBlockSize = rand.nextInt(500000);
|
|
||||||
|
|
||||||
if(testBlockSize > randomContent.length - currentContentPosition)
|
|
||||||
testBlockSize = randomContent.length - currentContentPosition;
|
|
||||||
|
|
||||||
boolean writeByteByByte = true; //rand.nextBoolean();
|
|
||||||
|
|
||||||
if(writeByteByByte) {
|
|
||||||
for(int i=0;i<testBlockSize;i++) {
|
|
||||||
os.write(randomContent[currentContentPosition++]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
boolean writeDirectlyFromContent = rand.nextBoolean();
|
|
||||||
|
|
||||||
if(writeDirectlyFromContent) {
|
|
||||||
os.write(randomContent, currentContentPosition, testBlockSize);
|
|
||||||
} else {
|
|
||||||
byte b[] = new byte[testBlockSize];
|
|
||||||
System.arraycopy(randomContent, currentContentPosition, b, 0, testBlockSize);
|
|
||||||
os.write(b);
|
|
||||||
}
|
|
||||||
currentContentPosition += testBlockSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
os.close();
|
|
||||||
|
|
||||||
compressedOutput = compressedOutputStream.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void randomizedTest() throws IOException {
|
|
||||||
try {
|
|
||||||
InputStream is = new LZ4BlockInputStream(new ByteArrayInputStream(compressedOutput));
|
|
||||||
|
|
||||||
int currentContentPosition = 0;
|
|
||||||
|
|
||||||
while(currentContentPosition < randomContent.length) {
|
|
||||||
int testBlockSize = rand.nextInt(500000);
|
|
||||||
|
|
||||||
boolean shouldTestBytes = rand.nextBoolean();
|
|
||||||
|
|
||||||
if(shouldTestBytes) {
|
|
||||||
boolean shouldReadOneByOne = rand.nextBoolean();
|
|
||||||
|
|
||||||
if(shouldReadOneByOne) {
|
|
||||||
currentContentPosition += assertContentByteByByte(is, currentContentPosition, testBlockSize);
|
|
||||||
} else {
|
|
||||||
currentContentPosition += assertContentInSingleBlock(is, currentContentPosition, testBlockSize);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
currentContentPosition += skipContent(is, testBlockSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assertEquals(-1, is.read(new byte[100]));
|
|
||||||
assertEquals(-1, is.read());
|
|
||||||
} catch(Throwable t) {
|
|
||||||
MainUtil.handleError(t);
|
|
||||||
Assert.fail("Exception was thrown. Seed value was " + seed);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private int assertContentByteByByte(InputStream is, int currentContentPosition, int testBlockSize) throws IOException {
|
|
||||||
int readContentLength = 0;
|
|
||||||
|
|
||||||
while(readContentLength < testBlockSize) {
|
|
||||||
int readContent = is.read();
|
|
||||||
|
|
||||||
if(readContent == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
assertEquals(randomContent[currentContentPosition + readContentLength], (byte)readContent);
|
|
||||||
readContentLength++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return readContentLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int assertContentInSingleBlock(InputStream is, int currentContentPosition, int testBlockSize) throws IOException {
|
|
||||||
int readContentLength;
|
|
||||||
byte readContent[] = new byte[testBlockSize];
|
|
||||||
|
|
||||||
readContentLength = is.read(readContent);
|
|
||||||
|
|
||||||
assertEqualContent(readContent, currentContentPosition, readContentLength);
|
|
||||||
|
|
||||||
return readContentLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int skipContent(InputStream is, int testBlockSize) throws IOException {
|
|
||||||
return (int) is.skip(testBlockSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertEqualContent(byte readContent[], int uncompressedContentOffset, int readContentLength) {
|
|
||||||
if(readContentLength < 0 && uncompressedContentOffset < randomContent.length)
|
|
||||||
Assert.fail("Decompressed content was incomplete. Index " + uncompressedContentOffset + ". Seed was " + seed);
|
|
||||||
|
|
||||||
for(int i=0;i<readContentLength;i++) {
|
|
||||||
String message = "Bytes differed! Seed value was " + seed;
|
|
||||||
Assert.assertEquals(message, randomContent[uncompressedContentOffset + i], readContent[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
|
||||||
<!--
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>LZ4 compression. The entry point of the API is the
|
|
||||||
{@link net.jpountz.lz4.LZ4Factory} class, which gives access to
|
|
||||||
{@link net.jpountz.lz4.LZ4Compressor compressors} and
|
|
||||||
{@link net.jpountz.lz4.LZ4SafeDecompressor decompressors}.</p>
|
|
||||||
|
|
||||||
|
|
||||||
<p>Sample usage:</p>
|
|
||||||
|
|
||||||
<pre class="prettyprint">
|
|
||||||
LZ4Factory factory = LZ4Factory.fastestInstance();
|
|
||||||
|
|
||||||
byte[] data = "12345345234572".getBytes("UTF-8");
|
|
||||||
final int decompressedLength = data.length;
|
|
||||||
|
|
||||||
// compress data
|
|
||||||
LZ4Compressor compressor = factory.fastCompressor();
|
|
||||||
int maxCompressedLength = compressor.maxCompressedLength(decompressedLength);
|
|
||||||
byte[] compressed = new byte[maxCompressedLength];
|
|
||||||
int compressedLength = compressor.compress(data, 0, decompressedLength, compressed, 0, maxCompressedLength);
|
|
||||||
|
|
||||||
// decompress data
|
|
||||||
// - method 1: when the decompressed length is known
|
|
||||||
LZ4FastDecompressor decompressor = factory.fastDecompressor();
|
|
||||||
byte[] restored = new byte[decompressedLength];
|
|
||||||
int compressedLength2 = decompressor.decompress(compressed, 0, restored, 0, decompressedLength);
|
|
||||||
// compressedLength == compressedLength2
|
|
||||||
|
|
||||||
// - method 2: when the compressed length is known (a little slower)
|
|
||||||
// the destination buffer needs to be over-sized
|
|
||||||
LZ4SafeDecompressor decompressor2 = factory.safeDecompressor();
|
|
||||||
int decompressedLength2 = decompressor2.decompress(compressed, 0, compressedLength, restored, 0);
|
|
||||||
// decompressedLength == decompressedLength2
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,22 +0,0 @@
|
|||||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
|
||||||
<!--
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Utility classes.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
BIN
core/src/main/resources/linux/arm/liblz4-java.so
Normal file
BIN
core/src/main/resources/linux/arm/liblz4-java.so
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user