KryoSerializers { public static void register(ThreadLocal<Kryo> kryoThreadLocal, boolean isDocumentSerializer) { if (isDocumentSerializer) { kryoForDocumentPerThreadCustom = kryoThreadLocal; } else { kryoForObjectPerThreadCustom = kryoThreadLocal; } } private  KryoSerializers(); static Kryo create(boolean isObjectSerializer); static void register(ThreadLocal<Kryo> kryoThreadLocal, boolean isDocumentSerializer); static Output serializeDocument(ServiceDocument o, int maxSize); static Output serializeAsDocument(Object o, int maxSize); static Output serializeDocumentForIndexing(Object o, int maxSize); static int serializeObject(Object o, byte[] buffer, int position); static ByteBuffer serializeObject(Object o, int maxSize); static T clone(T t); static T cloneObject(T t); static byte[] getBuffer(int capacity); static Object deserializeObject(ByteBuffer bb); static Object deserializeObject(byte[] bytes, int position, int length); static Object deserializeDocument(byte[] bytes, int position, int length); static Object deserializeDocument(ByteBuffer bb); static final long THREAD_LOCAL_BUFFER_LIMIT_BYTES; }
@Test public void readPre111() throws Exception { String prefix = "pre-1.1.1-"; Field kryoHandleBuiltinCollections = KryoSerializers.class.getDeclaredField("KRYO_HANDLE_BUILTIN_COLLECTIONS"); kryoHandleBuiltinCollections.setAccessible(true); try { KryoSerializers.register(new KryoForObjectThreadLocal(), false); kryoHandleBuiltinCollections.set(null, false); readFileAndDeserialize(prefix + "emptyList"); readFileAndDeserialize(prefix + "emptyMap"); readFileAndDeserialize(prefix + "emptyNavigableMap"); readFileAndDeserialize(prefix + "emptySortedMap"); readFileAndDeserialize(prefix + "emptySet"); readFileAndDeserialize(prefix + "singletonSet"); readFileAndDeserialize(prefix + "singletonList"); readFileAndDeserialize(prefix + "singletonMap"); } finally { kryoHandleBuiltinCollections.set(null, false); KryoSerializers.register(null, false); } }