Hi,

try something like:

String dir = System.getProperty("java.io.tmpdir");

IgniteUtils.setWorkDirectory(dir, null);
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
iCfg.setBinaryConfiguration(bCfg);
BinaryContext ctx = new
BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new
NullLogger());
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(new MarshallerContextImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext",
ctx, iCfg);

byte[] bytes = marsh.marshal(new HashMap<String, String>() {
            {
                put("1", "1");
            }
});

For second question:

((BinaryObjectImpl)bo).array()



2016-05-24 0:05 GMT+03:00 guill-melo <[email protected]>:

> Hello All,
> I have just recently started using Ignite, and I am really enjoying it, I
> am
> trying to profile the size of some objects and compare it with other types
> of serializations, is it possible to use the serialization without starting
> a Ignite process? The only way I could do it was:
>
>        IgniteConfiguration cfg = new IgniteConfiguration();
>         Ignite ignite = Ignition.start(cfg);
>         Entity entity = Entity
>                 .build()
>                 .withId("12345")
>                 .withField("value field")
>                 .withOtherField(33)
>                 .build();
>         BinaryObject binaryObject = ignite.binary().toBinary(entity);
>
> Also, Is there a utility to convert the BinaryObject to byte[] ou should I
> just treat it like any other object?
>
> Thanks !!
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Working-Directly-with-Binary-objects-tp5131.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 

Best regards,
Alexei Scherbakov

Reply via email to