Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- buf.writeInt(x);
- buf.writeShort(y);
- buf.writeInt(z);
- buf.writeByte(Chunk.WIDTH - 1);
- buf.writeByte(Chunk.HEIGHT - 1);
- buf.writeByte(Chunk.LENGTH - 1);
- byte[] compressedData = new byte[(Chunk.WIDTH * Chunk.LENGTH * Chunk.HEIGHT * 5) / 2]; // 81,920
- Deflater deflater = new Deflater(Deflater.BEST_SPEED);
- deflater.setInput(data);
- deflater.finish();
- int compressed = deflater.deflate(compressedData);
- deflater.end();
- buf.writeInt(compressed);
- buf.writeBytes(compressedData, 0, compressed);
- return buf;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement