@InterfaceAudience.Public @InterfaceStability.Stable public class ObjectWritable extends Object implements Writable, Configurable
Constructor and Description |
---|
ObjectWritable() |
ObjectWritable(Class declaredClass,
Object instance) |
ObjectWritable(Object instance) |
Modifier and Type | Method and Description |
---|---|
Object |
get()
Return the instance, or null if none.
|
Configuration |
getConf()
Return the configuration used by this object.
|
Class |
getDeclaredClass()
Return the class this is meant to be.
|
static Class<?> |
loadClass(Configuration conf,
String className)
Find and load the class with given name
className by first finding
it in the specified conf . |
void |
readFields(DataInput in)
Deserialize the fields of this object from
in . |
static Object |
readObject(DataInput in,
Configuration conf)
|
static Object |
readObject(DataInput in,
ObjectWritable objectWritable,
Configuration conf)
|
void |
set(Object instance)
Reset the instance.
|
void |
setConf(Configuration conf)
Set the configuration to be used by this object.
|
String |
toString() |
void |
write(DataOutput out)
Serialize the fields of this object to
out . |
static void |
writeObject(DataOutput out,
Object instance,
Class declaredClass,
Configuration conf)
|
static void |
writeObject(DataOutput out,
Object instance,
Class declaredClass,
Configuration conf,
boolean allowCompactArrays)
|
public ObjectWritable()
public ObjectWritable(Object instance)
public Object get()
public Class getDeclaredClass()
public void set(Object instance)
instance
- instance.public void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deseriablize this object from.IOException
- any other problem for readFields.public void write(DataOutput out) throws IOException
Writable
out
.write
in interface Writable
out
- DataOuput
to serialize this object into.IOException
- any other problem for write.public static void writeObject(DataOutput out, Object instance, Class declaredClass, Configuration conf) throws IOException
out
- DataOutput.instance
- instance.conf
- Configuration.declaredClass
- declaredClass.IOException
- raised on errors performing I/O.public static void writeObject(DataOutput out, Object instance, Class declaredClass, Configuration conf, boolean allowCompactArrays) throws IOException
allowCompactArrays
- - set true for RPC and internal or intra-cluster
usages. Set false for inter-cluster, File, and other persisted output
usages, to preserve the ability to interchange files with other clusters
that may not be running the same version of software. Sometime in ~2013
we can consider removing this parameter and always using the compact format.conf
- configuration.out
- dataoutput.declaredClass
- declaredClass.instance
- instance.IOException
- raised on errors performing I/O.public static Object readObject(DataInput in, Configuration conf) throws IOException
conf
- configuration.in
- DataInput.IOException
- raised on errors performing I/O.public static Object readObject(DataInput in, ObjectWritable objectWritable, Configuration conf) throws IOException
in
- DataInput.objectWritable
- objectWritable.conf
- configuration.IOException
- raised on errors performing I/O.public static Class<?> loadClass(Configuration conf, String className)
className
by first finding
it in the specified conf
. If the specified conf
is null,
try load it directly.conf
- configuration.className
- classname.public void setConf(Configuration conf)
Configurable
setConf
in interface Configurable
conf
- configuration to be usedpublic Configuration getConf()
Configurable
getConf
in interface Configurable
Copyright © 2024 Apache Software Foundation. All rights reserved.