File | Date | Author | Commit |
---|---|---|---|
src | 2016-10-23 |
![]() |
[34ca39] Add unit tests |
.gitignore | 2016-10-16 |
![]() |
[bbb075] First compilable version |
.travis.yml | 2016-10-16 |
![]() |
[bbb075] First compilable version |
LICENSE | 2016-10-17 |
![]() |
[861eac] Update readme |
README.md | 2017-05-18 |
![]() |
[af33cd] Update README |
benchmark.xls | 2016-10-22 |
![]() |
[1441a5] Update benchmarks |
byte_size.png | 2016-10-22 |
![]() |
[1441a5] Update benchmarks |
pom.xml | 2017-08-14 |
![]() |
[c10029] Update roaring |
rate.png | 2016-10-22 |
![]() |
[1441a5] Update benchmarks |
Fast and compact serialization of Java object.
Use the provided static methods to serialize and/or deserialize your object(s). There is two ways:
- Raw serialization: the fastest
- Compressed serialization: slower but more compact
The serialization used our Snappy based specialized compressors.
import java.io.*;
import com.qwazr.externalizor.Externalizor;
public class FastSerialization {
public FastSerialization() {
MyClass object = new MyClass();
byte[] bytes;
// Serialization
try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
Externalizor.serializeRaw(object, output);
bytes = output.toByteArray();
}
// Deserialization
try (ByteArrayInputStream input = new ByteArrayInputStream(bytes)) {
MyClass object = Externalizor.deserializeRaw(input);
}
}
}
```
### Compressed serialization (slower but more compact)
In addition of the specialized compression (snappy) a GZIP compression is used on the final serialized stream
(slower but more compact).
```java
import java.io.*;
import com.qwazr.externalizor.Externalizor;
public class CompactSerialization {
public CompactSerialization() {
MyClass object = new MyClass();
byte[] bytes;
// Serialization
try (ByteArrayOutputStream input = new ByteArrayOutputStream()) {
Externalizor.serialize(object, output);
bytes = output.toByteArray();
}
// Deserialization
try (ByteArrayInputStream input = new ByteArrayInputStream(bytes)) {
object = Externalizor.deserialize(input);
}
}
}
In Maven's central repository:
central.maven.org/maven2/com/qwazr/externalizor
Add the following dependency to your pom.xml:
<dependency>
<groupId>com.qwazr</groupId>
<artifactId>externalizor</artifactId>
<version>1.3.1</version>
</dependency>
The code of the benchmark is here:
BenchmarkTest
Bytes sizes. Smaller is better.
Number of serialization and deserialization per seconds. Bigger is better.
Post bug reports or feature request to the Issue Tracker:
https://github.com/qwazr/externalizor/issues