Package org.jboss.marshalling

Examples of org.jboss.marshalling.Unmarshaller.readObject()


        if (maxObjectSize != Integer.MAX_VALUE) {
            input = new LimitingByteInput(input, maxObjectSize);
        }
        try {
            unmarshaller.start(input);
            Object obj = unmarshaller.readObject();
            unmarshaller.finish();
            return obj;
        } catch (LimitingByteInput.TooBigObjectException e) {
            discardingTooLongFrame = true;
            throw new TooLongFrameException();
View Full Code Here


        protected void setState(InputStream is) throws IOException, ClassNotFoundException {
            MarshallingConfiguration config = new MarshallingConfiguration();
            config.setClassResolver(new SimpleClassResolver(getStateTransferClassLoader()));
            Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(config);
            unmarshaller.start(Marshalling.createByteInput(is));
            this.state = unmarshaller.readObject(Serializable.class);
            unmarshaller.close();
        }

        private ClassLoader getStateTransferClassLoader() {
            ClassLoader loader = (classloader != null) ? classloader.get() : null;
View Full Code Here

    Object objectFromByteBufferInternal(byte[] buffer, int offset, int length) throws Exception {
        if (buffer == null) return null;
        Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(this.marshallingConfig);
        unmarshaller.start(Marshalling.createByteInput(new ByteArrayInputStream(buffer, offset, length)));
        try {
            return unmarshaller.readObject();
        } finally {
            unmarshaller.close();
        }
    }
View Full Code Here

        Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(this.marshallingConfig);
        unmarshaller.start(Marshalling.createByteInput(new ByteArrayInputStream(buffer, offset, length)));
        // read past the null/serializable byte
        unmarshaller.read();
        try {
            return unmarshaller.readObject();
        } finally {
            unmarshaller.close();
        }
    }
View Full Code Here

        Unmarshaller unmarshaller = testUnmarshallerProvider.create(configuration.clone(), byteInput);
        if (unmarshaller instanceof ObjectInputStreamUnmarshaller) {
            throw new SkipException(unmarshaller + " doesn't support start()");
        }
        System.out.println("Unmarshaller = " + unmarshaller + " (version set to " + configuration.getVersion() + ")");
        assertEquals(t, unmarshaller.readObject());
        unmarshaller.finish();
        baos.reset();
        byteOutput = Marshalling.createByteOutput(baos);
        marshaller.start(byteOutput);
        marshaller.writeObject(t);
View Full Code Here

        marshaller.finish();
        bytes = baos.toByteArray();
        byteInput = Marshalling.createByteInput(new ByteArrayInputStream(bytes));
        unmarshaller.start(byteInput);
        System.out.println("Unmarshaller = " + unmarshaller + " (version set to " + configuration.getVersion() + ")");
        assertEquals(t, unmarshaller.readObject());
        unmarshaller.finish();
    }

    static class TestStreamHeader implements StreamHeader {
View Full Code Here

        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() + ")");
        assertEquals(serializable, unmarshaller.readObject());
        unmarshaller.finish();
        assertEOF(unmarshaller);
        assertTrue(streamHeader.ok());
    }
View Full Code Here

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ByteInput byteInput = Marshalling.createByteInput(bais);
        config = configuration.clone();
        config.setClassExternalizerFactory(externalizerFactory);
        Unmarshaller unmarshaller = testUnmarshallerProvider.create(config, byteInput);
        Object o2 = unmarshaller.readObject();
        assertEquals(o, o2);
        Object o3 = unmarshaller.readObject();
        assertSame(o2, o3);
    }
View Full Code Here

        config = configuration.clone();
        config.setClassExternalizerFactory(externalizerFactory);
        Unmarshaller unmarshaller = testUnmarshallerProvider.create(config, byteInput);
        Object o2 = unmarshaller.readObject();
        assertEquals(o, o2);
        Object o3 = unmarshaller.readObject();
        assertSame(o2, o3);
    }

    public static final class TestExternalizableWithSerializableFields implements Externalizable {
View Full Code Here

            configuration.setVersion(2);
            configuration.setClassResolver(new SimpleClassResolver(DomainServerMain.class.getClassLoader()));
            unmarshaller = factory.createUnmarshaller(configuration);
            byteInput = Marshalling.createByteInput(initialInput);
            unmarshaller.start(byteInput);
            final ServerTask task = unmarshaller.readObject(ServerTask.class);
            unmarshaller.finish();
            containerFuture = task.run(Arrays.<ServiceActivator>asList(new ServiceActivator() {
                @Override
                public void activate(final ServiceActivatorContext serviceActivatorContext) {
                    // TODO activate host controller client service
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.