Class ProtoProvenanceSerialization
java.lang.Object
com.oracle.labs.mlrg.olcut.config.protobuf.ProtoProvenanceSerialization
- All Implemented Interfaces:
ProvenanceSerialization
Class for serializing and deserializing provenances to/from protobufs.
Uses Base64 to encode and decode binary protobufs into and out of Strings if requested, though it
is preferable to use protobuf's built-in text format.
-
Constructor Summary
ConstructorsConstructorDescriptionProtoProvenanceSerialization(boolean textFormat) Construct a ProtoProvenanceSerialization. -
Method Summary
Modifier and TypeMethodDescriptiondeserializeFromFile(Path path) Deserialize the marshalled provenances from the supplied protobuf.deserializeFromString(String input) voidserializeToFile(List<ObjectMarshalledProvenance> marshalledProvenances, Path path) serializeToProto(List<ObjectMarshalledProvenance> marshalledProvenances) Serialize the marshalled provenances into a protobuf.serializeToString(List<ObjectMarshalledProvenance> marshalledProvenances) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.provenance.io.ProvenanceSerialization
deserializeAndUnmarshal, deserializeAndUnmarshal, marshalAndSerialize, marshalAndSerialize
-
Constructor Details
-
ProtoProvenanceSerialization
Construct a ProtoProvenanceSerialization.- Parameters:
textFormat- Output a pbtxt.
-
-
Method Details
-
getFileExtension
- Specified by:
getFileExtensionin interfaceProvenanceSerialization
-
deserializeFromFile
- Specified by:
deserializeFromFilein interfaceProvenanceSerialization- Throws:
IOException
-
deserializeFromString
- Specified by:
deserializeFromStringin interfaceProvenanceSerialization
-
deserializeFromProto
Deserialize the marshalled provenances from the supplied protobuf.- Parameters:
proto- The protobuf to deserialize.- Returns:
- The marshalled provenances encoded in the protobuf.
-
serializeToProto
Serialize the marshalled provenances into a protobuf.- Parameters:
marshalledProvenances- The provenances to serialize.- Returns:
- A protobuf encoding all the provenances.
-
serializeToString
- Specified by:
serializeToStringin interfaceProvenanceSerialization
-
serializeToFile
public void serializeToFile(List<ObjectMarshalledProvenance> marshalledProvenances, Path path) throws IOException - Specified by:
serializeToFilein interfaceProvenanceSerialization- Throws:
IOException
-