Skip to content

Commit

Permalink
Move to kryo 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuba Kubrynski committed Aug 5, 2012
1 parent eb5bc14 commit 3a39da6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions pom.xml
Expand Up @@ -49,16 +49,18 @@
<version>0.5-rc1</version>
</dependency>

<!--
<dependency>
<groupId>com.googlecode</groupId>
<artifactId>kryo</artifactId>
<version>1.04</version>
</dependency>
-->

<!-- <dependency>
<dependency>
<groupId>com.esotericsoftware.kryo</groupId>
<artifactId>kryo</artifactId>
<version>2.19</version>
</dependency>-->
</dependency>
</dependencies>
</project>
14 changes: 11 additions & 3 deletions src/main/java/com/kubrynski/poc/serial/ObjectWriteTest.java
@@ -1,9 +1,10 @@
package com.kubrynski.poc.serial;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;

import java.io.*;
import java.nio.ByteBuffer;

/**
* @author Jakub Kubrynski <jkubrynski@gmail.com>
Expand All @@ -16,9 +17,15 @@ public class ObjectWriteTest {
public static final String FILE_MODE_RW = "rw";
public static final String FILE_MODE_R = "r";

/*
public static SerializationTest buildKryoSerialization() {
return new KryoSerialization();
}
*/

public static SerializationTest buildKryo2Serialization() {
return new Kryo2Serialization();
}

public static SerializationTest buildDirectSerialization() {
return new DirectSerialization();
Expand Down Expand Up @@ -122,6 +129,7 @@ public TestObject testReadBuffered(String fileName) throws IOException {
}
}

/*
private static class KryoSerialization implements SerializationTest {
private static Kryo kryo = new Kryo();
Expand Down Expand Up @@ -150,6 +158,7 @@ public TestObject testReadBuffered(String fileName) throws IOException {
try {
raf = new RandomAccessFile(fileName, FILE_MODE_R);
ByteBuffer byteBuffer = ByteBuffer.allocate(MAX_BUFFER_SIZE);
raf.read(byteBuffer.array());
return kryo.readObject(byteBuffer, TestObject.class);
} finally {
if (raf != null) {
Expand All @@ -158,8 +167,8 @@ public TestObject testReadBuffered(String fileName) throws IOException {
}
}
}
*/

/*
private static class Kryo2Serialization implements SerializationTest {

private static Kryo kryo = new Kryo();
Expand Down Expand Up @@ -191,7 +200,6 @@ public TestObject testReadBuffered(String fileName) throws IOException {

}
}
*/


}
Expand Up @@ -66,10 +66,10 @@ SerializationTest create() {
}
},

KRYO {
KRYO2 {
@Override
SerializationTest create() {
return ObjectWriteTest.buildKryoSerialization();
return ObjectWriteTest.buildKryo2Serialization();
}
},

Expand Down

0 comments on commit 3a39da6

Please sign in to comment.