Package com.esotericsoftware.kryo

Examples of com.esotericsoftware.kryo.Registration


            super.writeClass(output, null);
            return;
        }
        Object newObj = getReplacement(getMethods(object.getClass()).writeReplace,object);
        setAutoReset(false);
        Registration registration = super.writeClass(output, newObj.getClass());
        setAutoReset(true);
        super.writeObject(output, newObj, registration.getSerializer());
//        System.out.println("wrote an object "+newObj+" id "+registration.getId());
//        reset();
    }
View Full Code Here


    @Override
    public void writeObject(Output output, Object object, Serializer serializer) {
        Method m = getMethods(object.getClass()).writeReplace;
        if (m != null) {
            object = getReplacement(m, object);
            Registration reg = super.writeClass(output, object.getClass());
            serializer = reg.getSerializer();
        }
        super.writeObject(output, object, serializer);
//        System.out.println("wrote2 an object "+object+" id "+getRegistration(object.getClass()).getId());
       
    }
View Full Code Here

    public static void register(Class type, Serializer ser) {
        register(type, ser, -1);
    }
   
    public static void register(Class type, Serializer ser, int id) {
        registrations.add(new Registration(type, ser, id));
    }
View Full Code Here

            final Object tmpThreadLocals = ThreadAccess.getThreadLocals(currentThread);
            final Object tmpInheritableThreadLocals = ThreadAccess.getInheritableThreadLocals(currentThread);
            ThreadAccess.setThreadLocals(currentThread, null);
            ThreadAccess.setInheritablehreadLocals(currentThread, null);
            try {
                final Registration reg = kryo.readClass(input);
                if (reg == null)
                    return null;
                f = (Fiber) new FieldSerializer(kryo, reg.getType()).read(kryo, input, reg.getType());

                f.fiberLocals = ThreadAccess.getThreadLocals(currentThread);
                f.inheritableFiberLocals = ThreadAccess.getInheritableThreadLocals(currentThread);

                return f;
View Full Code Here

            super.writeClass(output, null);
            return;
        }
        Object newObj = getReplacement(getMethods(object.getClass()).writeReplace, object);
        setAutoReset(false);
        Registration registration = super.writeClass(output, newObj.getClass());
        setAutoReset(true);
        super.writeObject(output, newObj, registration.getSerializer());
//        System.out.println("wrote an object "+newObj+" id "+registration.getId());
//        reset();
    }
View Full Code Here

    @Override
    public void writeObject(Output output, Object object, Serializer serializer) {
        Method m = getMethods(object.getClass()).writeReplace;
        if (m != null) {
            object = getReplacement(m, object);
            Registration reg = super.writeClass(output, object.getClass());
            serializer = reg.getSerializer();
        }
        super.writeObject(output, object, serializer);
//        System.out.println("wrote2 an object "+object+" id "+getRegistration(object.getClass()).getId());

    }
View Full Code Here

    public static void register(Class type, Serializer ser) {
        register(type, ser, -1);
    }

    public static void register(Class type, Serializer ser, int id) {
        registrations.add(new Registration(type, ser, id));
    }
View Full Code Here

  }

  @Override
  public Registration writeClass(Output output, Class type)
  {
    Registration ret;
    before(output, type);
    ret = super.writeClass(output, type);
    after(output, type);
    return ret;
  }
View Full Code Here

            final Object tmpThreadLocals = ThreadAccess.getThreadLocals(currentThread);
            final Object tmpInheritableThreadLocals = ThreadAccess.getInheritableThreadLocals(currentThread);
            ThreadAccess.setThreadLocals(currentThread, null);
            ThreadAccess.setInheritablehreadLocals(currentThread, null);
            try {
                final Registration reg = kryo.readClass(input);
                if (reg == null)
                    return null;
                f = (Fiber) new FieldSerializer(kryo, reg.getType()).read(kryo, input, reg.getType());

                f.fiberLocals = ThreadAccess.getThreadLocals(currentThread);
                f.inheritableFiberLocals = ThreadAccess.getInheritableThreadLocals(currentThread);

                return f;
View Full Code Here

            int mapSize = input.readInt(true);
            NodeDocument doc = new NodeDocument(documentStore, created);
            for (int i = 0; i < mapSize; i++) {
                String key = input.readString();
                Registration reg = kryo.readClass(input);
                Object value;
                if (reg.getType() == NavigableMap.class) {
                    value = new RevisionedMapSerializer(kryo).read(kryo, input, Map.class);
                } else {
                    value = kryo.readObject(input, reg.getType());
                }
                doc.put(key, value);
            }

            //Seal the doc once all changes done
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.Registration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.