}
@Override
public ByteBuffer compress(ByteBuffer data) throws IOException {
ByteArrayOutputStream baos = getOutputBuffer(data.remaining());
OutputStream ios = new XZCompressorOutputStream(baos, compressionLevel);
writeAndClose(data, ios);
return ByteBuffer.wrap(baos.toByteArray());
}