T - the class of the objects to stringifyjava.io.Closeable, java.lang.AutoCloseable, Stringifier<T>@Public @Stable public class DefaultStringifier<T> extends java.lang.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 | Description |
|---|---|
DefaultStringifier(Configuration conf,
java.lang.Class<T> c) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Closes this object.
|
T |
fromString(java.lang.String str) |
Restores the object from its string representation.
|
static <K> K |
load(Configuration conf,
java.lang.String keyName,
java.lang.Class<K> itemClass) |
Restores the object from the configuration.
|
static <K> K[] |
loadArray(Configuration conf,
java.lang.String keyName,
java.lang.Class<K> itemClass) |
Restores the array of objects from the configuration.
|
static <K> void |
store(Configuration conf,
K item,
java.lang.String keyName) |
Stores the item in the configuration with the given keyName.
|
static <K> void |
storeArray(Configuration conf,
K[] items,
java.lang.String keyName) |
Stores the array of items in the configuration with the given keyName.
|
java.lang.String |
toString(T obj) |
Converts the object to a string representation
|
public DefaultStringifier(Configuration conf, java.lang.Class<T> c)
public T fromString(java.lang.String str) throws java.io.IOException
StringifierfromString in interface Stringifier<T>str - the string representation of the objectjava.io.IOException - if the object cannot be restoredpublic java.lang.String toString(T obj) throws java.io.IOException
StringifiertoString in interface Stringifier<T>obj - the object to convertjava.io.IOException - if the object cannot be convertedpublic void close()
throws java.io.IOException
Stringifierclose in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface Stringifier<T>java.io.IOException - if an I/O error occurspublic static <K> void store(Configuration conf, K item, java.lang.String keyName) throws java.io.IOException
K - the class of the itemconf - the configuration to storeitem - the object to be storedkeyName - the name of the key to usejava.io.IOException - : forwards Exceptions from the underlying
Serialization classes.public static <K> K load(Configuration conf, java.lang.String keyName, java.lang.Class<K> itemClass) throws java.io.IOException
K - the class of the itemconf - the configuration to usekeyName - the name of the key to useitemClass - the class of the itemjava.io.IOException - : forwards Exceptions from the underlying
Serialization classes.public static <K> void storeArray(Configuration conf, K[] items, java.lang.String keyName) throws java.io.IOException
K - the class of the itemconf - the configuration to useitems - the objects to be storedkeyName - the name of the key to usejava.lang.IndexOutOfBoundsException - if the items array is emptyjava.io.IOException - : forwards Exceptions from the underlying
Serialization classes.public static <K> K[] loadArray(Configuration conf, java.lang.String keyName, java.lang.Class<K> itemClass) throws java.io.IOException
K - the class of the itemconf - the configuration to usekeyName - the name of the key to useitemClass - the class of the itemjava.io.IOException - : forwards Exceptions from the underlying
Serialization classes.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.