@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); } }
@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) { 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 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 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); } } }
@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); } }
@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); } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public void serialize(Object object, Output output, Map<?, ?> kryoPreferences) throws SerializationException { if (MapUtils.isNotEmpty(kryoPreferences)) { ObjectMap<Object, Object> graphContext = kryo.getGraphContext(); for (Entry<?, ?> entry : kryoPreferences.entrySet()) { graphContext.put(entry.getKey(), entry.getValue()); } } try { kryo.writeClassAndObject(output, object); output.flush(); } catch (Exception exception) { throw new SerializationException("Serialization failed.\n" + exception.getMessage(), exception); } }
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); } }
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) { try { ObjectMap graphContext = kryo.getGraphContext(); ObjectInputStream objectStream = (ObjectInputStream) graphContext.get(this); if (objectStream == null) { objectStream = new ObjectInputStream(input) { @Override protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { return ClassUtils.getClass(KryoSerialization.class.getClassLoader(), desc.getName()); } }; 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) { 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); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void write(Kryo kryo, Output output, T object) { ObjectMap<Object, Object> garphContext = kryo.getGraphContext(); if (Boolean.FALSE.equals(garphContext.get(KryoSerializationPreferences.WRITE_INVOCATION_AFFILIATION_DATA))) { Map<Long, MutableInt> temp = object.getInvocationsParentsIdMap(); object.setInvocationsParentsIdMap(Collections.<Long, MutableInt> emptyMap()); super.write(kryo, output, object); object.setInvocationsParentsIdMap(temp); } else { super.write(kryo, output, object); } } }
@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); } }
@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, T object) { CachedField[] fields = getFields(); ObjectMap context = kryo.getGraphContext(); if (!context.containsKey(this)) { context.put(this, null); if (TRACE) trace("kryo", "Write " + fields.length + " field names."); output.writeVarInt(fields.length, true); for (int i = 0, n = fields.length; i < n; i++) output.writeString(fields[i].field.getName()); } OutputChunked outputChunked = new OutputChunked(output, 1024); for (int i = 0, n = fields.length; i < n; i++) { fields[i].write(outputChunked, object); outputChunked.endChunks(); } }
public void write (Kryo kryo, Output output, T object) { CachedField[] fields = getFields(); ObjectMap context = kryo.getGraphContext(); if (!context.containsKey(this)) { context.put(this, null); if (TRACE) trace("kryo", "Write " + fields.length + " field names."); output.writeVarInt(fields.length, true); for (int i = 0, n = fields.length; i < n; i++) output.writeString(fields[i].field.getName()); } OutputChunked outputChunked = new OutputChunked(output, 1024); for (int i = 0, n = fields.length; i < n; i++) { fields[i].write(outputChunked, object); outputChunked.endChunks(); } }
public void write (Kryo kryo, Output output, T object) { CachedField[] fields = getFields(); ObjectMap context = kryo.getGraphContext(); if (!context.containsKey(this)) { context.put(this, null); if (TRACE) trace("kryo", "Write " + fields.length + " field names."); output.writeVarInt(fields.length, true); for (int i = 0, n = fields.length; i < n; i++) output.writeString(getCachedFieldName(fields[i])); } OutputChunked outputChunked = new OutputChunked(output, 1024); for (int i = 0, n = fields.length; i < n; i++) { fields[i].write(outputChunked, object); outputChunked.endChunks(); } }
public void write (Kryo kryo, Output output, T object) { CachedField[] fields = getFields(); ObjectMap context = kryo.getGraphContext(); if (!context.containsKey(this)) { context.put(this, null); if (TRACE) trace("kryo", "Write " + fields.length + " field names."); output.writeVarInt(fields.length, true); for (int i = 0, n = fields.length; i < n; i++) output.writeString(getCachedFieldName(fields[i])); } OutputChunked outputChunked = new OutputChunked(output, 1024); for (int i = 0, n = fields.length; i < n; i++) { fields[i].write(outputChunked, object); outputChunked.endChunks(); } }