@SuppressWarnings({"unchecked", "rawtypes"}) @Override public void write(Kryo kryo, Output output, T o) { try { ObjectMap graphContext = kryo.getGraphContext(); ObjectOutputStream objectStream = (ObjectOutputStream)graphContext.get(this); if (objectStream == null) { objectStream = new ObjectOutputStream(output); graphContext.put(this, objectStream); } objectStream.writeObject(o); objectStream.flush(); } catch (Exception ex) { throw new KryoException("Error during Java serialization.", ex); } }
public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); return ObjectSpace.getRemoteObject(connection, objectID, type); } }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public T read(Kryo kryo, Input input, Class aClass) { try { ObjectMap graphContext = kryo.getGraphContext(); ObjectInputStream objectStream = (ObjectInputStream)graphContext.get(this); if (objectStream == null) { // make sure we use Kryo's classloader objectStream = new InstantiationUtil.ClassLoaderObjectInputStream(input, kryo.getClassLoader()); graphContext.put(this, objectStream); } return (T) objectStream.readObject(); } catch (Exception ex) { throw new KryoException("Error during Java deserialization.", ex); } }
public void write (Kryo kryo, Output output, Object object) { Connection connection = (Connection)kryo.getContext().get("connection"); int id = getRegisteredID(connection, object); if (id == Integer.MAX_VALUE) throw new KryoNetException("Object not found in an ObjectSpace: " + object); output.writeInt(id, true); }
public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); return object; } });
public Registration getRegistration (Class type) { if (type == memoizedClass) return memoizedClassValue; Registration registration = classToRegistration.get(type); if (registration != null) { memoizedClass = type; memoizedClassValue = registration; } return registration; }
public Registration getRegistration (Class type) { if (type == memoizedClass) return memoizedClassValue; Registration registration = classToRegistration.get(type); if (registration != null) { memoizedClass = type; memoizedClassValue = registration; } return registration; }
public Registration getRegistration (Class type) { if (type == memoizedClass) return memoizedClassValue; Registration registration = classToRegistration.get(type); if (registration != null) { memoizedClass = type; memoizedClassValue = registration; } return registration; }
protected Class<?> getTypeByName(final String className) { return nameToClass != null ? nameToClass.get(className) : null; }
protected Class<?> getTypeByName (final String className) { return nameToClass != null ? nameToClass.get(className) : null; }
public Registration getRegistration (Class type) { if (type == memoizedClass) return memoizedClassValue; Registration registration = classToRegistration.get(type); if (registration != null) { memoizedClass = type; memoizedClassValue = registration; } return registration; }
private JavaSerializer getCachedSerializer (Class type) { if (javaSerializerByType == null) { javaSerializerByType = new ObjectMap<Class, JavaSerializer>(); return null; } return javaSerializerByType.get(type); }
private JavaSerializer getCachedSerializer (Class type) { if (javaSerializerByType == null) { javaSerializerByType = new ObjectMap<Class, JavaSerializer>(); return null; } return javaSerializerByType.get(type); }
private JavaSerializer getCachedSerializer (Class type) { if (javaSerializerByType == null) { javaSerializerByType = new ObjectMap<Class, JavaSerializer>(); return null; } return javaSerializerByType.get(type); }
public void write (Kryo kryo, Output output, Object object) { try { ObjectMap graphContext = kryo.getGraphContext(); ObjectOutputStream objectStream = (ObjectOutputStream)graphContext.get(this); if (objectStream == null) { objectStream = new ObjectOutputStream(output); graphContext.put(this, objectStream); } objectStream.writeObject(object); objectStream.flush(); } catch (Exception ex) { throw new KryoException("Error during Java serialization.", ex); } }
public Object read (Kryo kryo, Input input, Class type) { try { ObjectMap graphContext = kryo.getGraphContext(); ObjectInputStream objectStream = (ObjectInputStream)graphContext.get(this); if (objectStream == null) { objectStream = new ObjectInputStream(input); graphContext.put(this, objectStream); } return objectStream.readObject(); } catch (Exception ex) { throw new KryoException("Error during Java deserialization.", ex); } } }
public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); return ObjectSpace.getRemoteObject(connection, objectID, type); } }
public Object read (Kryo kryo, Input input, Class type) { try { ObjectMap graphContext = kryo.getGraphContext(); ObjectInputStream objectStream = (ObjectInputStream)graphContext.get(this); if (objectStream == null) { objectStream = new ObjectInputStreamWithKryoClassLoader(input, kryo); graphContext.put(this, objectStream); } return objectStream.readObject(); } catch (Exception ex) { throw new KryoException("Error during Java deserialization.", ex); } }
@Override public Object read(Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection) kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && (object == null)) { warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); } return object; } }, nextRegistrationId++);
public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); return object; } });