use of org.jboss.marshalling.MarshallerFactory in project jdepth by Crab2died.
the class MarshallingCodeCFactory method buildDecoder.
public static MarshallingDecoder buildDecoder() {
MarshallerFactory factory = Marshalling.getProvidedMarshallerFactory("serial");
MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
UnmarshallerProvider provider = new DefaultUnmarshallerProvider(factory, configuration);
return new MarshallingDecoder(provider, 1024);
}
use of org.jboss.marshalling.MarshallerFactory in project netty by netty.
the class AbstractCompatibleMarshallingDecoderTest method testFragmentedUnmarshalling.
@Test
public void testFragmentedUnmarshalling() throws IOException {
MarshallerFactory marshallerFactory = createMarshallerFactory();
MarshallingConfiguration configuration = createMarshallingConfig();
EmbeddedChannel ch = new EmbeddedChannel(createDecoder(Integer.MAX_VALUE));
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
marshaller.start(Marshalling.createByteOutput(bout));
marshaller.writeObject(testObject);
marshaller.finish();
marshaller.close();
byte[] testBytes = bout.toByteArray();
ByteBuf buffer = input(testBytes);
ByteBuf slice = buffer.readRetainedSlice(2);
ch.writeInbound(slice);
ch.writeInbound(buffer);
assertTrue(ch.finish());
String unmarshalled = ch.readInbound();
assertEquals(testObject, unmarshalled);
assertNull(ch.readInbound());
}
use of org.jboss.marshalling.MarshallerFactory in project netty by netty.
the class AbstractCompatibleMarshallingDecoderTest method testTooBigObject.
@Test
public void testTooBigObject() throws IOException {
MarshallerFactory marshallerFactory = createMarshallerFactory();
MarshallingConfiguration configuration = createMarshallingConfig();
ChannelHandler mDecoder = createDecoder(4);
EmbeddedChannel ch = new EmbeddedChannel(mDecoder);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
marshaller.start(Marshalling.createByteOutput(bout));
marshaller.writeObject(testObject);
marshaller.finish();
marshaller.close();
byte[] testBytes = bout.toByteArray();
onTooBigFrame(ch, input(testBytes));
}
use of org.jboss.marshalling.MarshallerFactory in project jvm-serializers by eishay.
the class JBossMarshalling method register.
public static void register(final TestGroups groups) {
MarshallerFactory riverFactory = new RiverMarshallerFactory();
groups.media.add(JavaBuiltIn.mediaTransformer, new MarshallingSerializer<MediaContent>(MediaContent.class, "jboss-marshalling-river", riverFactory, false, false), new SerFeatures(SerFormat.BINARY, SerGraph.FULL_GRAPH, SerClass.ZERO_KNOWLEDGE, "full graph zero knowledge"));
groups.media.add(JavaBuiltIn.mediaTransformer, new MarshallingSerializer<MediaContent>(MediaContent.class, "jboss-marshalling-river-manual", riverFactory, false, true), new SerFeatures(SerFormat.BINARY, SerGraph.FULL_GRAPH, SerClass.MANUAL_OPT, "full graph with manual optimizations"));
groups.media.add(JavaBuiltIn.mediaTransformer, new MarshallingSerializer<MediaContent>(MediaContent.class, "jboss-marshalling-river-ct", riverFactory, true, false), new SerFeatures(SerFormat.BINARY, SerGraph.FULL_GRAPH, SerClass.CLASSES_KNOWN, "full graph with preregistered classes"));
groups.media.add(JavaBuiltIn.mediaTransformer, new MarshallingSerializer<MediaContent>(MediaContent.class, "jboss-marshalling-river-ct-manual", riverFactory, true, true), new SerFeatures(SerFormat.BINARY, SerGraph.FULL_GRAPH, SerClass.MANUAL_OPT, "full graph preregistered classes, manual optimization"));
groups.media.add(JavaBuiltIn.mediaTransformer, new MarshallingSerializer<MediaContent>(MediaContent.class, "jboss-marshalling-serial", new SerialMarshallerFactory(), false, false), new SerFeatures(SerFormat.BINARY, SerGraph.FULL_GRAPH, SerClass.ZERO_KNOWLEDGE, ""));
}
use of org.jboss.marshalling.MarshallerFactory in project jdepth by Crab2died.
the class MarshallingCodeCFactory method buildEncoder.
public static MarshallingEncoder buildEncoder() {
MarshallerFactory factory = Marshalling.getProvidedMarshallerFactory("serial");
MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
MarshallerProvider provider = new DefaultMarshallerProvider(factory, configuration);
return new MarshallingEncoder(provider);
}
Aggregations