public final class CoderHelpers
extends java.lang.Object
| Modifier and Type | Method and Description | 
|---|---|
| static <T> T | fromByteArray(byte[] serialized,
             Coder<T> coder)Utility method for deserializing a byte array using the specified coder. | 
| static <T> java.lang.Iterable<T> | fromByteArrays(java.util.Collection<byte[]> serialized,
              Coder<T> coder)Utility method for deserializing a Iterable of byte arrays using the specified coder. | 
| static <K,V> org.apache.spark.api.java.function.PairFunction<scala.Tuple2<ByteArray,byte[]>,K,V> | fromByteFunction(Coder<K> keyCoder,
                Coder<V> valueCoder)A function wrapper for converting a byte array pair to a key-value pair. | 
| static <T> org.apache.spark.api.java.function.Function<byte[],T> | fromByteFunction(Coder<T> coder)A function wrapper for converting a byte array to an object. | 
| static <K,V> org.apache.spark.api.java.function.PairFunction<scala.Tuple2<ByteArray,java.lang.Iterable<byte[]>>,K,java.lang.Iterable<V>> | fromByteFunctionIterable(Coder<K> keyCoder,
                        Coder<V> valueCoder)A function wrapper for converting a byte array pair to a key-value pair, where
 values are  Iterable. | 
| static <T> byte[] | toByteArray(T value,
           Coder<T> coder)Utility method for serializing an object using the specified coder. | 
| static <T> java.util.List<byte[]> | toByteArrays(java.lang.Iterable<T> values,
            Coder<T> coder)Utility method for serializing a Iterable of values using the specified coder. | 
| static <K,V> org.apache.spark.api.java.function.PairFunction<scala.Tuple2<K,V>,ByteArray,byte[]> | toByteFunction(Coder<K> keyCoder,
              Coder<V> valueCoder)A function wrapper for converting a key-value pair to a byte array pair. | 
| static <T> org.apache.spark.api.java.function.Function<T,byte[]> | toByteFunction(Coder<T> coder)A function wrapper for converting an object to a bytearray. | 
public static <T> byte[] toByteArray(T value,
                                     Coder<T> coder)
T - type of value that is serializedvalue - Value to serialize.coder - Coder to serialize with.public static <T> java.util.List<byte[]> toByteArrays(java.lang.Iterable<T> values,
                                                      Coder<T> coder)
T - type of value that is serializedvalues - Values to serialize.coder - Coder to serialize with.public static <T> T fromByteArray(byte[] serialized,
                                  Coder<T> coder)
T - Type of object to be returned.serialized - bytearray to be deserialized.coder - Coder to deserialize with.public static <T> java.lang.Iterable<T> fromByteArrays(java.util.Collection<byte[]> serialized,
                                                       Coder<T> coder)
T - Type of object to be returned.serialized - bytearrays to be deserialized.coder - Coder to deserialize with.public static <T> org.apache.spark.api.java.function.Function<T,byte[]> toByteFunction(Coder<T> coder)
T - The type of the object being serialized.coder - Coder to serialize with.public static <T> org.apache.spark.api.java.function.Function<byte[],T> fromByteFunction(Coder<T> coder)
T - The type of the object being deserialized.coder - Coder to deserialize with.public static <K,V> org.apache.spark.api.java.function.PairFunction<scala.Tuple2<K,V>,ByteArray,byte[]> toByteFunction(Coder<K> keyCoder, Coder<V> valueCoder)
K - The type of the key being serialized.V - The type of the value being serialized.keyCoder - Coder to serialize keys.valueCoder - Coder to serialize values.public static <K,V> org.apache.spark.api.java.function.PairFunction<scala.Tuple2<ByteArray,byte[]>,K,V> fromByteFunction(Coder<K> keyCoder, Coder<V> valueCoder)
K - The type of the key being deserialized.V - The type of the value being deserialized.keyCoder - Coder to deserialize keys.valueCoder - Coder to deserialize values.public static <K,V> org.apache.spark.api.java.function.PairFunction<scala.Tuple2<ByteArray,java.lang.Iterable<byte[]>>,K,java.lang.Iterable<V>> fromByteFunctionIterable(Coder<K> keyCoder, Coder<V> valueCoder)
Iterable.K - The type of the key being deserialized.V - The type of the value being deserialized.keyCoder - Coder to deserialize keys.valueCoder - Coder to deserialize values.