Package org.jboss.marshalling

Examples of org.jboss.marshalling.Marshaller.writeObject()


        assertEquals(t, unmarshaller.readObject());
        unmarshaller.finish();
        baos.reset();
        byteOutput = Marshalling.createByteOutput(baos);
        marshaller.start(byteOutput);
        marshaller.writeObject(t);
        marshaller.finish();
        bytes = baos.toByteArray();
        byteInput = Marshalling.createByteInput(new ByteArrayInputStream(bytes));
        unmarshaller.start(byteInput);
        System.out.println("Unmarshaller = " + unmarshaller + " (version set to " + configuration.getVersion() + ")");
View Full Code Here


        configuration.setStreamHeader(streamHeader);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(10240);
        ByteOutput byteOutput = Marshalling.createByteOutput(baos);
        Marshaller marshaller = testMarshallerProvider.create(configuration.clone(), byteOutput);
        System.out.println("Marshaller = " + marshaller + " (version set to " + configuration.getVersion() + ")");
        marshaller.writeObject(serializable);
        marshaller.finish();
        byte[] bytes = baos.toByteArray();
        ByteInput byteInput = Marshalling.createByteInput(new ByteArrayInputStream(bytes));
        Unmarshaller unmarshaller = testUnmarshallerProvider.create(configuration.clone(), byteInput);
        System.out.println("Unmarshaller = " + unmarshaller + " (version set to " + configuration.getVersion() + ")");
View Full Code Here

        config.setClassExternalizerFactory(externalizerFactory);
        Marshaller marshaller = testMarshallerProvider.create(config, byteOutput);
//        if (marshaller instanceof SerialMarshaller) {
//            throw new SkipException("TODO: Known issue - see JBMAR-50");
//        }
        marshaller.writeObject(o);
        marshaller.writeObject(o);
        marshaller.flush();
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ByteInput byteInput = Marshalling.createByteInput(bais);
        config = configuration.clone();
View Full Code Here

        Marshaller marshaller = testMarshallerProvider.create(config, byteOutput);
//        if (marshaller instanceof SerialMarshaller) {
//            throw new SkipException("TODO: Known issue - see JBMAR-50");
//        }
        marshaller.writeObject(o);
        marshaller.writeObject(o);
        marshaller.flush();
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ByteInput byteInput = Marshalling.createByteInput(bais);
        config = configuration.clone();
        config.setClassExternalizerFactory(externalizerFactory);
View Full Code Here

                    return beanReferenceFactory.createReference(beanRepositoryIds[0]);
                } else if (locator instanceof StatefulEJBLocator) {
                    final Marshaller marshaller = factory.createMarshaller(configuration);
                    final ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    marshaller.start(new OutputStreamByteOutput(stream));
                    marshaller.writeObject(((StatefulEJBLocator) locator).getSessionId());
                    marshaller.finish();
                    return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
                } else if (locator instanceof EntityEJBLocator) {
                    final Marshaller marshaller = factory.createMarshaller(configuration);
                    final ByteArrayOutputStream stream = new ByteArrayOutputStream();
View Full Code Here

                    return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
                } else if (locator instanceof EntityEJBLocator) {
                    final Marshaller marshaller = factory.createMarshaller(configuration);
                    final ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    marshaller.start(new OutputStreamByteOutput(stream));
                    marshaller.writeObject(((EntityEJBLocator) locator).getPrimaryKey());
                    marshaller.finish();
                    return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
                }
                throw EjbLogger.EJB3_LOGGER.unknownEJBLocatorType(locator);
            } else {
View Full Code Here

                output.writeInt(version);
                MarshallingConfiguration config = this.passivationManager.getMarshallingConfiguration(version);
                Marshaller marshaller = this.marshallerFactory.createMarshaller(config);
                marshaller.start(output);
                try {
                    marshaller.writeObject(obj);
                    marshaller.finish();
                } finally {
                    marshaller.close();
                }
            } finally {
View Full Code Here

            if (contextLoader != null) {
                currentLoader = getCurrentThreadContextClassLoader();
                setCurrentThreadContextClassLoader(contextLoader);
            }
            try {
                marshaller.writeObject(this.object);
            } finally {
                if (contextLoader != null) {
                    setCurrentThreadContextClassLoader(currentLoader);
                }
            }
View Full Code Here

                    StateTransferProvider provider = entry.getValue();

                    Marshaller marshaller = marshallerFactory.createMarshaller(new MarshallingConfiguration());
                    ByteArrayOutputStream output = new ByteArrayOutputStream();
                    marshaller.start(Marshalling.createByteOutput(output));
                    marshaller.writeObject(provider.getCurrentState());
                    marshaller.close();
                    byte[] bytes = output.toByteArray();
                    out.writeInt(bytes.length);
                    out.write(bytes);
                }
View Full Code Here

     */
    byte[] objectToByteBufferInternal(Object object) throws Exception {
        Marshaller marshaller = marshallerFactory.createMarshaller(new MarshallingConfiguration());
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        marshaller.start(Marshalling.createByteOutput(output));
        marshaller.writeObject(object);
        marshaller.close();
        return output.toByteArray();
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.