StepObjectInputStream(final Queue<Step> steps, final ClonerPutField clonerPutField, final Object clone, final SerializableClass cloneInfo) throws IOException { super(new StepObjectInput(steps)); this.clonerPutField = clonerPutField; this.clone = clone; this.cloneInfo = cloneInfo; }
/** * Create a new instance. * * @param configuration the configuration */ CloneableCloner(final ClonerConfiguration configuration) { final CloneTable cloneTable = configuration.getCloneTable(); this.cloneTable = cloneTable == null ? CloneTable.NULL : cloneTable; }
public StepObjectInputStream run() throws Exception { return new StepObjectInputStream(steps, fields, clone, cloneInfo); } });
private ObjectCloner createCloner(final ClonerConfiguration paramConfig) { ObjectCloner parameterCloner; if(WildFlySecurityManager.isChecking()) { parameterCloner = WildFlySecurityManager.doUnchecked((PrivilegedAction<ObjectCloner>) () -> ObjectCloners.getSerializingObjectClonerFactory().createCloner(paramConfig)); } else { parameterCloner = ObjectCloners.getSerializingObjectClonerFactory().createCloner(paramConfig); } return parameterCloner; }
protected Object doReadObject(final boolean unshared) throws ClassNotFoundException, IOException { Step step = current; while (step instanceof ByteDataStep) { step = steps.poll(); } if (step == null) { current = null; throw new EOFException(); } current = steps.poll(); // not really true, just IDEA being silly again @SuppressWarnings("UnnecessaryThis") final Object clone = SerializingCloner.this.clone(((CloneStep) step).getOrig()); return clone; }
public ObjectCloner createNew() { return factory.createCloner(finalConfig); } };
protected void doWriteObject(final Object obj, final boolean unshared) throws IOException { super.flush(); final ByteArrayOutputStream baos = byteArrayOutputStream; if (baos.size() > 0) { steps.add(new ByteDataStep(baos.toByteArray())); baos.reset(); } steps.add(new CloneStep(obj)); }
public int available() throws IOException { return current instanceof ByteDataStep ? ((ByteDataStep) current).getBytes().length - idx : 0; }
public void put(final String name, final char val) { fieldMap.put(name, new CharReadField(getField(name, Kind.CHAR), val)); }
public ObjectCloner createCloner(final ClonerConfiguration configuration) { return new CloneableCloner(configuration); } };
public ObjectCloner createCloner(final ClonerConfiguration configuration) { return new SerializingCloner(configuration); } };
public StepObjectOutputStream run() throws IOException { return new StepObjectOutputStream(steps, fields, orig); } });
void doFinish() throws IOException { output.doFinish(); } }
StepObjectOutputStream(final Queue<Step> steps, final ClonerPutField clonerPutField, final Object subject) throws IOException { this(new StepObjectOutput(steps), steps, clonerPutField, subject); }
public int read(final byte[] b) throws IOException { return read(b, 0, b.length); }
/** * Get an object cloner source which creates cloners with a static configuration. * * @param factory the cloner factory to use * @param configuration the configuration to use for all cloners * @return the cloner source */ public static ObjectClonerSource createObjectClonerSource(final ObjectClonerFactory factory, final ClonerConfiguration configuration) { final ClonerConfiguration finalConfig = configuration.clone(); return new ObjectClonerSource() { public ObjectCloner createNew() { return factory.createCloner(finalConfig); } }; } }
/** {@inheritDoc} */ public Class<?> cloneProxy(final Class<?> proxyClass) throws IOException, ClassNotFoundException { final Class<?>[] origInterfaces = proxyClass.getInterfaces(); final Class<?>[] interfaces = new Class[origInterfaces.length]; for (int i = 0, origInterfacesLength = origInterfaces.length; i < origInterfacesLength; i++) { interfaces[i] = clone(origInterfaces[i]); } return Proxy.getProxyClass(destClassLoader, interfaces); } }
public int read() throws IOException { while (current != null) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); if (idx == bytes.length) { current = steps.poll(); idx = 0; } else { final byte b = bytes[idx++]; return b & 0xff; } } else { // an object is pending return -1; } } return -1; }
public void put(final String name, final boolean val) { fieldMap.put(name, new BooleanReadField(getField(name, Kind.BOOLEAN), val)); }