Package org.apache.flink.util
Class CompressedSerializedValue<T>
- java.lang.Object
-
- org.apache.flink.util.SerializedValue<T>
-
- org.apache.flink.util.CompressedSerializedValue<T>
-
- All Implemented Interfaces:
Serializable
@Internal public class CompressedSerializedValue<T> extends SerializedValue<T>
An extension ofSerializedValue
that compresses the value after the serialization.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
deserializeValue(ClassLoader loader)
Decompress and deserialize the data to get the original object.static <T> CompressedSerializedValue<T>
fromBytes(byte[] compressedSerializedData)
Construct a compressed serialized value with a serialized byte array.static <T> CompressedSerializedValue<T>
fromObject(T object)
Constructs a compressed serialized value for the given object.int
getSize()
Returns the size of the compressed serialized data.String
toString()
-
Methods inherited from class org.apache.flink.util.SerializedValue
equals, getByteArray, hashCode
-
-
-
-
Method Detail
-
deserializeValue
public T deserializeValue(ClassLoader loader) throws IOException, ClassNotFoundException
Decompress and deserialize the data to get the original object.- Overrides:
deserializeValue
in classSerializedValue<T>
- Parameters:
loader
- the classloader to deserialize- Returns:
- the deserialized object
- Throws:
IOException
- exception during decompression and deserializationClassNotFoundException
- if class is not found in the classloader
-
getSize
public int getSize()
Returns the size of the compressed serialized data.
-
fromObject
public static <T> CompressedSerializedValue<T> fromObject(T object) throws IOException
Constructs a compressed serialized value for the given object.- Parameters:
object
- the object to serialize and compress- Throws:
NullPointerException
- if object is nullIOException
- exception during serialization and compression
-
fromBytes
public static <T> CompressedSerializedValue<T> fromBytes(byte[] compressedSerializedData)
Construct a compressed serialized value with a serialized byte array.The byte array must be the result of serialization and compression with
InstantiationUtil.serializeObjectAndCompress(java.lang.Object)
.- Type Parameters:
T
- type of the object- Parameters:
compressedSerializedData
- the compressed serialized byte array- Returns:
CompressedSerializedValue
that can be deserialized as the object
-
toString
public String toString()
- Overrides:
toString
in classSerializedValue<T>
-
-