Deserialize source in native elasticsearch script plugin

I am using a native sort script & I wish to deserialize source inside it. I have access to the SourceLookup object.

SourceLookup source = source();

which gives me the bytes

byte[] bytes = source.internalSourceRef().toBytes()

What is the serialization format of this object's bytes and how can I deserialize it efficiently?