mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
StateMap — use LZ4 instead of snappy
This commit is contained in:
@@ -20,5 +20,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.testExtensions" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
|
||||
<orderEntry type="library" name="XStream" level="project" />
|
||||
<orderEntry type="library" name="lz4-java" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -9,8 +9,8 @@ import com.intellij.util.ArrayUtil
|
||||
import com.intellij.util.SystemProperties
|
||||
import com.intellij.util.isEmpty
|
||||
import gnu.trove.THashMap
|
||||
import org.iq80.snappy.SnappyFramedInputStream
|
||||
import org.iq80.snappy.SnappyFramedOutputStream
|
||||
import net.jpountz.lz4.LZ4BlockInputStream
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream
|
||||
import org.jdom.Element
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.util.*
|
||||
@@ -18,13 +18,13 @@ import java.util.concurrent.atomic.AtomicReferenceArray
|
||||
|
||||
fun archiveState(state: Element): BufferExposingByteArrayOutputStream {
|
||||
val byteOut = BufferExposingByteArrayOutputStream()
|
||||
SnappyFramedOutputStream(byteOut).use {
|
||||
LZ4BlockOutputStream(byteOut).use {
|
||||
serializeElementToBinary(state, it)
|
||||
}
|
||||
return byteOut
|
||||
}
|
||||
|
||||
private fun unarchiveState(state: ByteArray) = SnappyFramedInputStream(ByteArrayInputStream(state), false).use { deserializeElementFromBinary(it) }
|
||||
private fun unarchiveState(state: ByteArray) = LZ4BlockInputStream(ByteArrayInputStream(state)).use { deserializeElementFromBinary(it) }
|
||||
|
||||
fun getNewByteIfDiffers(key: String, newState: Any, oldState: ByteArray): ByteArray? {
|
||||
val newBytes: ByteArray
|
||||
|
||||
Reference in New Issue
Block a user