Class RdfProtoSerializer

All Implemented Interfaces:
Function<Object,byte[]>, ThrowingFunction<Object,byte[]>, RdfMetaProvider, XmlMetaProvider

Stream-based RDF serializer for RDF/PROTO binary format.

Serializes POJOs to compact binary RDF using Protocol Buffers encoding, ideal for efficient storage and network transfer. Semantically equivalent to RDF/XML and other RDF text formats.

Examples:

// Serialize a bean to RDF/PROTO bytes. Person person = new Person("Alice", 30); byte[] protoBytes = RdfProtoSerializer.DEFAULT.write(person);

// Or use the RdfProto marshaller for convenience. byte[] protoBytes = RdfProto.of(person);

// Serialize to OutputStream. RdfProtoSerializer.DEFAULT.write(person, outputStream);

// Custom serializer with swaps. RdfProtoSerializer s = RdfProtoSerializer.create().swaps(DateSwap.class).build(); byte[] bytes = s.write(bean);

Output is binary (byte[]), Protocol Buffers format. Complex structures (nested objects, arrays) serialize to equivalent RDF triples in binary form.

Notes:
  • This class is thread safe and reusable.
See Also: