Package org.apache.flink.types
Interface CopyableValue<T>
-
- All Superinterfaces:
IOReadableWritable
,Serializable
,Value
- All Known Implementing Classes:
BooleanValue
,ByteValue
,CharValue
,DoubleValue
,FloatValue
,IntValue
,LongValue
,NullValue
,Record
,ShortValue
,StringValue
@Public public interface CopyableValue<T> extends Value
Interface to be implemented by basic types that support to be copied efficiently.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
copy()
Performs a deep copy of this object into a new instance.void
copy(DataInputView source, DataOutputView target)
Copies the next serialized instance fromsource
totarget
.void
copyTo(T target)
Performs a deep copy of this object into thetarget
instance.int
getBinaryLength()
Gets the length of the data type when it is serialized, in bytes.-
Methods inherited from interface org.apache.flink.core.io.IOReadableWritable
read, write
-
-
-
-
Method Detail
-
getBinaryLength
int getBinaryLength()
Gets the length of the data type when it is serialized, in bytes.- Returns:
- The length of the data type, or
-1
, if variable length.
-
copyTo
void copyTo(T target)
Performs a deep copy of this object into thetarget
instance.- Parameters:
target
- Object to copy into.
-
copy
T copy()
Performs a deep copy of this object into a new instance.This method is useful for generic user-defined functions to clone a
CopyableValue
when storing multiple objects. With object reuse a deep copy must be created and type erasure prevents calling new.- Returns:
- New object with copied fields.
-
copy
void copy(DataInputView source, DataOutputView target) throws IOException
Copies the next serialized instance fromsource
totarget
.This method is equivalent to calling
IOReadableWritable.read(DataInputView)
followed byIOReadableWritable.write(DataOutputView)
but does not require intermediate deserialization.- Parameters:
source
- Data source for serialized instance.target
- Data target for serialized instance.- Throws:
IOException
- See Also:
IOReadableWritable
-
-