Class ObjectFileSerialization
java.lang.Object
org.apache.wayang.basic.operators.ObjectFileSerialization
Utility methods that convert between Java objects and the on-disk representation used by
ObjectFileSink.-
Method Summary
Modifier and TypeMethodDescriptiondeserializeChunk(byte[] payload, ObjectFileSerializationMode mode, Class<?> elementType) Deserialize a chunk of objects.static byte[]serializeChunk(Object[] chunk, int validLength, ObjectFileSerializationMode mode) Serialize a chunk of objects using the providedObjectFileSerializationMode.
-
Method Details
-
serializeChunk
public static byte[] serializeChunk(Object[] chunk, int validLength, ObjectFileSerializationMode mode) throws IOException Serialize a chunk of objects using the providedObjectFileSerializationMode.- Parameters:
chunk- buffer that contains the objects to serializevalidLength- number of valid entries insidechunkmode- the serialization mode- Returns:
- serialized bytes
- Throws:
IOException- if serialization fails
-
deserializeChunk
public static List<Object> deserializeChunk(byte[] payload, ObjectFileSerializationMode mode, Class<?> elementType) throws IOException, ClassNotFoundException Deserialize a chunk of objects.- Parameters:
payload- the serialized datamode- the serialization modeelementType- the expected element type- Returns:
- list of deserialized objects (never
null) - Throws:
IOException- if deserialization failsClassNotFoundException- if a class cannot be resolved in legacy mode
-