Search in sources :

Example 1 with FastByteArraysInputStream

use of com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream in project FastAsyncWorldEdit by IntellectualSites.

the class MemoryOptimizedHistory method getBlockIS.

@Override
public FaweInputStream getBlockIS() throws IOException {
    if (ids == null) {
        return null;
    }
    FaweInputStream result = MainUtil.getCompressedIS(new FastByteArraysInputStream(ids));
    readHeader(result);
    return result;
}
Also used : FaweInputStream(com.fastasyncworldedit.core.internal.io.FaweInputStream) FastByteArraysInputStream(com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream)

Example 2 with FastByteArraysInputStream

use of com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream in project FastAsyncWorldEdit by IntellectualSites.

the class CompressedSchematicTag method adapt.

@Override
public LZ4BlockInputStream adapt(Clipboard src) throws IOException {
    FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
    try (LZ4BlockOutputStream lz4out = new LZ4BlockOutputStream(blocksOut)) {
        NBTOutputStream nbtOut = new NBTOutputStream(lz4out);
        new FastSchematicWriter(nbtOut).write(getSource());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    FastByteArraysInputStream in = new FastByteArraysInputStream(blocksOut.toByteArrays());
    return new LZ4BlockInputStream(in);
}
Also used : LZ4BlockOutputStream(net.jpountz.lz4.LZ4BlockOutputStream) FastSchematicWriter(com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter) FastByteArrayOutputStream(com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream) FastByteArraysInputStream(com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream) IOException(java.io.IOException) NBTOutputStream(com.sk89q.jnbt.NBTOutputStream) LZ4BlockInputStream(net.jpountz.lz4.LZ4BlockInputStream)

Aggregations

FastByteArraysInputStream (com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream)2 FastSchematicWriter (com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter)1 FastByteArrayOutputStream (com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream)1 FaweInputStream (com.fastasyncworldedit.core.internal.io.FaweInputStream)1 NBTOutputStream (com.sk89q.jnbt.NBTOutputStream)1 IOException (java.io.IOException)1 LZ4BlockInputStream (net.jpountz.lz4.LZ4BlockInputStream)1 LZ4BlockOutputStream (net.jpountz.lz4.LZ4BlockOutputStream)1