T - the class of the objects to stringify@InterfaceAudience.Public @InterfaceStability.Stable public class DefaultStringifier<T> extends Object implements Stringifier<T>
Stringifier
 interface which stringifies the objects using base64 encoding of the
 serialized version of the objects. The Serializer and
 Deserializer are obtained from the SerializationFactory.
 | Constructor and Description | 
|---|
| DefaultStringifier(Configuration conf,
                  Class<T> c) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Closes this object. | 
| T | fromString(String str)Restores the object from its string representation. | 
| static <K> K | load(Configuration conf,
    String keyName,
    Class<K> itemClass)Restores the object from the configuration. | 
| static <K> K[] | loadArray(Configuration conf,
         String keyName,
         Class<K> itemClass)Restores the array of objects from the configuration. | 
| static <K> void | store(Configuration conf,
     K item,
     String keyName)Stores the item in the configuration with the given keyName. | 
| static <K> void | storeArray(Configuration conf,
          K[] items,
          String keyName)Stores the array of items in the configuration with the given keyName. | 
| String | toString(T obj)Converts the object to a string representation | 
public DefaultStringifier(Configuration conf, Class<T> c)
public T fromString(String str) throws IOException
StringifierfromString in interface Stringifier<T>str - the string representation of the objectIOException - if the object cannot be restoredpublic String toString(T obj) throws IOException
StringifiertoString in interface Stringifier<T>obj - the object to convertIOException - if the object cannot be convertedpublic void close()
           throws IOException
Stringifierclose in interface Closeableclose in interface AutoCloseableclose in interface Stringifier<T>IOException - if an I/O error occurspublic static <K> void store(Configuration conf, K item, String keyName) throws IOException
K - the class of the itemconf - the configuration to storeitem - the object to be storedkeyName - the name of the key to useIOException - : forwards Exceptions from the underlying 
 Serialization classes.public static <K> K load(Configuration conf, String keyName, Class<K> itemClass) throws IOException
K - the class of the itemconf - the configuration to usekeyName - the name of the key to useitemClass - the class of the itemIOException - : forwards Exceptions from the underlying 
 Serialization classes.public static <K> void storeArray(Configuration conf, K[] items, String keyName) throws IOException
K - the class of the itemconf - the configuration to useitems - the objects to be storedkeyName - the name of the key to useIndexOutOfBoundsException - if the items array is emptyIOException - : forwards Exceptions from the underlying 
 Serialization classes.public static <K> K[] loadArray(Configuration conf, String keyName, Class<K> itemClass) throws IOException
K - the class of the itemconf - the configuration to usekeyName - the name of the key to useitemClass - the class of the itemIOException - : forwards Exceptions from the underlying 
 Serialization classes.Copyright © 2020 Apache Software Foundation. All rights reserved.