public final class AvroConfigurationSerializer extends Object implements ConfigurationSerializer
This class is stateless and is therefore safe to reuse.
Constructor and Description |
---|
AvroConfigurationSerializer() |
Modifier and Type | Method and Description |
---|---|
void |
configurationBuilderFromString(String theString,
ConfigurationBuilder configBuilder)
Converts a given serialized string to ConfigurationBuilder from which Configuration can be produced.
|
Configuration |
fromAvro(AvroConfiguration avroConfiguration)
Converts a given AvroConfiguration to Configuration.
|
Configuration |
fromAvro(AvroConfiguration avroConfiguration,
ClassHierarchy classHierarchy)
Converts a given AvroConfiguration to Configuration.
|
Configuration |
fromByteArray(byte[] theBytes)
Loads a Configuration from a byte[] created with toByteArray().
|
Configuration |
fromByteArray(byte[] theBytes,
ClassHierarchy classHierarchy)
Loads a Configuration from a byte[] created with toByteArray().
|
Configuration |
fromFile(File file)
Loads a Configuration from a File created with toFile().
|
Configuration |
fromFile(File file,
ClassHierarchy classHierarchy)
Loads a Configuration from a File created with toFile().
|
Configuration |
fromString(String theString)
Decodes a String generated via toString().
|
Configuration |
fromString(String theString,
ClassHierarchy classHierarchy)
Decodes a String generated via toString().
|
Configuration |
fromTextFile(File file)
Loads a Configuration from a File created with toFile().
|
Configuration |
fromTextFile(File file,
ClassHierarchy classHierarchy)
Loads a Configuration from a File created with toFile() with ClassHierarchy.
|
AvroConfiguration |
toAvro(Configuration configuration) |
byte[] |
toByteArray(Configuration conf)
Writes the Configuration to a byte[].
|
void |
toFile(Configuration conf,
File file)
Stores the given Configuration in the given File.
|
String |
toString(Configuration configuration)
Writes the Configuration as a String.
|
void |
toTextFile(Configuration conf,
File file)
Stores the given Configuration in the given Text File.
|
public static final String JAVA
public static final String CS
@Inject public AvroConfigurationSerializer()
public AvroConfiguration toAvro(Configuration configuration)
public void toFile(Configuration conf, File file) throws IOException
ConfigurationSerializer
toFile
in interface ConfigurationSerializer
conf
- the Configuration to storefile
- the file to store the Configuration inIOException
- if there is an IO error in the process.public void toTextFile(Configuration conf, File file) throws IOException
ConfigurationSerializer
toTextFile
in interface ConfigurationSerializer
conf
- the Configuration to storefile
- the file to store the Configuration inIOException
- if there is an IO error in the process.public byte[] toByteArray(Configuration conf) throws IOException
ConfigurationSerializer
toByteArray
in interface ConfigurationSerializer
conf
- the Configuration to be convertedIOException
- if encoding fails to writepublic String toString(Configuration configuration)
ConfigurationSerializer
toString
in interface ConfigurationSerializer
configuration
- the Configuration to be convertedpublic Configuration fromAvro(AvroConfiguration avroConfiguration) throws BindException
avroConfiguration
- a Avro configurationBindException
public Configuration fromAvro(AvroConfiguration avroConfiguration, ClassHierarchy classHierarchy) throws BindException
avroConfiguration
- a Avro configurationclassHierarchy
- the class hierarchy used for validation.BindException
public Configuration fromFile(File file) throws IOException, BindException
ConfigurationSerializer
fromFile
in interface ConfigurationSerializer
file
- the File to read from.IOException
- if the File can't be read or parsedBindException
- if the file contains an illegal Configurationpublic Configuration fromFile(File file, ClassHierarchy classHierarchy) throws IOException, BindException
ConfigurationSerializer
fromFile
in interface ConfigurationSerializer
file
- the File to read from.classHierarchy
- used to validate the configuration againstIOException
- if the File can't be read or parsedBindException
- if the file contains an illegal Configurationpublic Configuration fromTextFile(File file) throws IOException, BindException
ConfigurationSerializer
fromTextFile
in interface ConfigurationSerializer
file
- the File to read from.IOException
- if the File can't be read or parsedBindException
- if the file contains an illegal Configurationpublic Configuration fromTextFile(File file, ClassHierarchy classHierarchy) throws IOException, BindException
ConfigurationSerializer
fromTextFile
in interface ConfigurationSerializer
file
- the File to read from.classHierarchy
- the class hierarchy to be used.IOException
- if the File can't be read or parsedBindException
public Configuration fromByteArray(byte[] theBytes) throws IOException, BindException
ConfigurationSerializer
fromByteArray
in interface ConfigurationSerializer
theBytes
- the bytes to deserialize.IOException
- if the byte[] can't be deserializedBindException
- if the byte[] contains an illegal Configuration.public Configuration fromByteArray(byte[] theBytes, ClassHierarchy classHierarchy) throws IOException, BindException
ConfigurationSerializer
fromByteArray
in interface ConfigurationSerializer
theBytes
- the bytes to deserialize.classHierarchy
- used to validate the configuration againstIOException
- if the byte[] can't be deserializedBindException
- if the byte[] contains an illegal Configuration.public Configuration fromString(String theString) throws IOException, BindException
ConfigurationSerializer
fromString
in interface ConfigurationSerializer
theString
- to be parsedIOException
- if theString can't be parsed.BindException
- if theString contains an illegal Configuration.public Configuration fromString(String theString, ClassHierarchy classHierarchy) throws IOException, BindException
ConfigurationSerializer
fromString
in interface ConfigurationSerializer
theString
- to be parsedclassHierarchy
- used to validate the configuration againstIOException
- if theString can't be parsed.BindException
- if theString contains an illegal Configuration.public void configurationBuilderFromString(String theString, ConfigurationBuilder configBuilder) throws IOException, BindException
theString
- the String containing configurationconfigBuilder
- a configuration builderIOException
- if the string is not Avro formatBindException
- if the content of configuration string is invalid to bindCopyright © 2016 The Apache Software Foundation. All rights reserved.