Cloneable, SequenceablePacMap, PersistablePacMappublic class BasePacMap extends Object implements Sequenceable, Cloneable
This class is a base class of PacMap. You are not advised to use this class directly.
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
protected HashMap<String,Object> |
dataMap |
Indicates the
Hashmap that stores the key-value pairs in BasePacMap. |
| 构造器 | 说明 |
|---|---|
BasePacMap() |
Default constructor used to create a
BasePacMap instance, in which the Map object has no
key-value pair. |
BasePacMap(int capacity) |
A constructor used to create a
BasePacMap instance with the number of key-value pairs specified by
Map. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
clear() |
Clears the current object.
|
protected Object |
clone() |
Creates and returns a copy of this object.
|
boolean |
equals(Object object) |
Indicates whether some other object is "equal to" this one.
|
protected Map<String,Object> |
getAll() |
Obtains all the data that has been stored.
|
boolean |
getBooleanValue(String key) |
Obtains the
boolean value matching a specified key. |
boolean |
getBooleanValue(String key,
boolean defaultValue) |
Obtains the
boolean value matching a specified key. |
boolean[] |
getBooleanValueArray(String key) |
Obtains the
boolean[] value matching a specified key. |
byte |
getByteValue(String key) |
Obtains the
byte value matching a specified key. |
byte |
getByteValue(String key,
byte defaultValue) |
Obtains the
byte value matching a specified key. |
byte[] |
getByteValueArray(String key) |
Obtains the
byte[] value matching a specified key. |
char |
getChar(String key) |
Obtains the
char value matching a specified key. |
char |
getChar(String key,
char defaultValue) |
Obtains the
char value matching a specified key. |
char[] |
getCharArray(String key) |
Obtains the
char[] value matching a specified key. |
ClassLoader |
getClassLoader() |
Obtains the
ClassLoader used by the inner object within this PacMap instance. |
Dimension |
getDimension(String key) |
Obtains the
Dimension object in PacMap based on the specified key. |
double |
getDoubleValue(String key) |
Obtains the
double value matching a specified key. |
double |
getDoubleValue(String key,
double defaultValue) |
Obtains the
double value matching a specified key. |
double[] |
getDoubleValueArray(String key) |
Obtains the
double[] value matching a specified key. |
FloatDimension |
getFloatDimension(String key) |
Obtains the
FloatDimension object in PacMap based on the specified key. |
float |
getFloatValue(String key) |
Obtains the
float value matching a specified key. |
float |
getFloatValue(String key,
float defaultValue) |
Obtains the
float value matching a specified key. |
float[] |
getFloatValueArray(String key) |
Obtains the
float[] value matching a specified key. |
int |
getIntValue(String key) |
Obtains the
int value matching a specified key. |
int |
getIntValue(String key,
int defaultValue) |
Obtains the
int value matching a specified key. |
int[] |
getIntValueArray(String key) |
Obtains the
int[] value matching a specified key. |
Set<String> |
getKeys() |
Obtains all the keys of the current object.
|
long |
getLongValue(String key) |
Obtains the
long value matching a specified key. |
long |
getLongValue(String key,
long defaultValue) |
Obtains the
long value matching a specified key. |
long[] |
getLongValueArray(String key) |
Obtains the
long[] value matching a specified key. |
Optional<Object> |
getObjectValue(String key) |
Obtains an object with a specified key.
|
protected <T> Optional<T> |
getObjectValue(String key,
Class<T> clazz) |
Obtains an object with a specified key and object type.
|
PlainArray<?> |
getPlainArray(String key) |
Obtains a
PlainArray<T> object based on a specified key. |
<T> T |
getRemoteObject(String key,
Class<T> clz) |
Obtains an
IRemoteObject based on a specified key. |
short |
getShortValue(String key) |
Obtains the
short value matching a specified key. |
short |
getShortValue(String key,
short defaultValue) |
Obtains the
short value matching a specified key. |
short[] |
getShortValueArray(String key) |
Obtains the
short[] value matching a specified key. |
int |
getSize() |
Obtains the number of key-value pairs stored in the current object.
|
String |
getString(String key) |
Obtains the
String value matching a specified key. |
String |
getString(String key,
String defaultValue) |
Obtains the
String value matching a specified key. |
String[] |
getStringArray(String key) |
Obtains the
String[] value matching a specified key. |
boolean |
hasFileDescriptor() |
Checks whether the implementation class of this
Sequenceable contains FileDescriptor object data. |
int |
hashCode() |
Returns a hash code value for the object.
|
boolean |
hasKey(String key) |
Checks whether a specified key is contained.
|
boolean |
isEmpty() |
Checks whether the current object is empty.
|
boolean |
marshalling(Parcel out) |
Writes a
Sequenceable object into a Parcel. |
protected void |
putAll(Map<String,Object> map) |
Inserts all key-value pairs of a
Map object into the built-in data object. |
void |
putAll(BasePacMap map) |
Saves the key-value pairs in a
BasePacMap object on the current object. |
void |
putBooleanValue(String key,
boolean value) |
Adds a
boolean value matching a specified key. |
void |
putBooleanValueArray(String key,
boolean[] value) |
Adds a
boolean[] value matching a specified key. |
void |
putByteValue(String key,
byte value) |
Adds a
byte value matching a specified key. |
void |
putByteValueArray(String key,
byte[] value) |
Adds a
byte[] value matching a specified key. |
void |
putChar(String key,
char value) |
Adds a
char value matching a specified key. |
void |
putCharArray(String key,
char[] value) |
Adds a
char[] value matching a specified key. |
void |
putDimension(String key,
Dimension value) |
Inserts a key-value pair whose key is
String and value is Dimension into PacMap. |
void |
putDoubleValue(String key,
double value) |
Adds a
double value matching a specified key. |
void |
putDoubleValueArray(String key,
double[] value) |
Adds a
double[] value matching a specified key. |
void |
putFloatDimension(String key,
FloatDimension value) |
Inserts a key-value pair whose key is
String and value is FloatDimension into PacMap. |
void |
putFloatValue(String key,
float value) |
Adds a
float value matching a specified key. |
void |
putFloatValueArray(String key,
float[] value) |
Adds a
float[] value matching a specified key. |
void |
putIntValue(String key,
int value) |
Adds an
int value matching a specified key. |
void |
putIntValueArray(String key,
int[] value) |
Adds an
int[] value matching a specified key. |
void |
putLongValue(String key,
long value) |
Adds a
long value matching a specified key. |
void |
putLongValueArray(String key,
long[] value) |
Adds a
long[] value matching a specified key. |
protected void |
putObjectValue(String key,
Object value) |
Adds a universal object with a specified key.
|
void |
putPlainArray(String key,
PlainArray<? extends Sequenceable> value) |
Inserts a key-value pair whose key is
String and value is PlainArray into PacMap. |
void |
putRemoteObject(String key,
Object value) |
Inserts a key-value pair whose key is
String and value is Object into PacMap. |
void |
putShortValue(String key,
short value) |
Adds a
short value matching a specified key. |
void |
putShortValueArray(String key,
short[] value) |
Adds a
short[] value matching a specified key. |
void |
putString(String key,
String value) |
Adds a
String value matching a specified key. |
void |
putStringArray(String key,
String[] value) |
Adds a
String[] value matching a specified key. |
void |
remove(String key) |
Deletes a key-value pair with a specified key.
|
void |
setClassLoader(ClassLoader loader) |
Sets the
ClassLoader used to create an inner object within this PacMap instance. |
boolean |
unmarshalling(Parcel in) |
Restores a
Sequenceable object from a Parcel. |
public BasePacMap(int capacity)
BasePacMap instance with the number of key-value pairs specified by
Map.capacity - Indicates the number of key-value pairs specified by Map.public BasePacMap()
BasePacMap instance, in which the Map object has no
key-value pair.public void putAll(BasePacMap map)
BasePacMap object on the current object.map - Indicates the BasePacMap object whose key-value pairs are to be saved.protected void putAll(Map<String,Object> map)
Map object into the built-in data object.map - Indicates the Map object whose keys are strings.protected void putObjectValue(String key, Object value)
key - Indicates the key in String format, which can be null.value - Indicates the object to be added.public void putByteValue(String key, byte value)
byte value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the byte value to be added.public void putShortValue(String key, short value)
short value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the short value to be added.public void putIntValue(String key, int value)
int value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the int value to be added.public void putLongValue(String key, long value)
long value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the long value to be added.public void putFloatValue(String key, float value)
float value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the float value to be added.public void putDoubleValue(String key, double value)
double value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the double value to be added.public void putBooleanValue(String key, boolean value)
boolean value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the boolean value to be added.public void putChar(String key, char value)
char value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the char value to be added.public void putString(String key, String value)
String value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the String value to be added.public void putByteValueArray(String key, byte[] value)
byte[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the byte[] value to be added.public void putShortValueArray(String key, short[] value)
short[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the short[] value to be added.public void putIntValueArray(String key, int[] value)
int[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the int[] value to be added.public void putLongValueArray(String key, long[] value)
long[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the long[] value to be added.public void putFloatValueArray(String key, float[] value)
float[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the float[] value to be added.public void putDoubleValueArray(String key, double[] value)
double[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the double[] value to be added.public void putBooleanValueArray(String key, boolean[] value)
boolean[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the boolean[] value to be added.public void putCharArray(String key, char[] value)
char[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the char[] value to be added.public void putStringArray(String key, String[] value)
String[] value matching a specified key. If a value matching the key already exists, it will be
replaced by the added value.key - Indicates the key in String format, which can be null.value - Indicates the String[] value to be added.public void setClassLoader(ClassLoader loader)
ClassLoader used to create an inner object within this PacMap instance.loader - Indicates the ClassLoader to set.getClassLoader()public ClassLoader getClassLoader()
ClassLoader used by the inner object within this PacMap instance.ClassLoader used by the inner object of this PacMap instance.setClassLoader(ClassLoader loader)public void putPlainArray(String key, PlainArray<? extends Sequenceable> value)
String and value is PlainArray into PacMap.
If the key already exists, its value is replaced by PlainArray. Otherwise,
this new key-value pair is inserted. The element types of PlainArray must inherit
from Sequenceable.
key - Indicates the key of the String type, which may be null.value - Indicates the value of the PlainArray type, which may be null.getPlainArray(String key)public PlainArray<?> getPlainArray(String key)
PlainArray<T> object based on a specified key.
The element types of PlainArray must inherit from Sequenceable.
key - Indicates the key of the String type.PlainArray object stored in this PacMap instance; Returns null
if the PlainArray does not exist or fails to be converted to the specified type.putPlainArray(String, PlainArray)public void putRemoteObject(String key, Object value)
String and value is Object into PacMap.
If the key already exists, its value is replaced by Object. Otherwise, this new key-value pair
is inserted. This method is implemented using the reflection mechanism, so value must be the IRemoteObject type. You must use MessageParcel that inherits from Parcel
when marshalling or unmarshalling this BasePacMap to obtain correct ohos.rpc.IRemoteObject value.
key - Indicates the key of the String type, which may be null.value - Indicates the value of the Object type.ParcelException - Throws this exception if the value is null or is not ohos.rpc.IRemoteObject.getRemoteObject(String, Class)public <T> T getRemoteObject(String key, Class<T> clz)
IRemoteObject based on a specified key.
This method is implemented using the reflection mechanism, so the returned T
value must be ohos.rpc.IRemoteObject.You must use MessageParcel that inherits from Parcel
when marshalling or unmarshalling this BasePacMap to obtain correct ohos.rpc.IRemoteObject value.
T - Indicates the return value type, which must be a ohos.rpc.IRemoteObject
type or its subclass.key - Indicates the key of the String type.clz - The class type of IRemoteObject, should be ohos.rpc.IRemoteObjectIRemoteObject stored in this PacMap instance; returns null
if Object does not exist or fails to be converted to the <T> type.ParcelException - Throws this exception if Object matching the key is not of the
IRemoteObject type.putRemoteObject(String key, Object value)public void putDimension(String key, Dimension value)
String and value is Dimension into PacMap.key - Indicates the key of the String type, which may be null.value - Indicates the value of the Dimension type, which may be null.getDimension(String key)public Dimension getDimension(String key)
Dimension object in PacMap based on the specified key.key - Indicates the key of the String type.Dimension object of the specified key; returns null if the query fails.putDimension(String key, Dimension value)public void putFloatDimension(String key, FloatDimension value)
String and value is FloatDimension into PacMap.key - Indicates the key of the String type, which may be null.value - Indicates the value of the FloatDimension type, which may be null.getFloatDimension(String key)public FloatDimension getFloatDimension(String key)
FloatDimension object in PacMap based on the specified key.key - Indicates the key of the String type.FloatDimension object of the specified key; returns null if the query fails.putFloatDimension(String key, FloatDimension value)protected Map<String,Object> getAll()
Map object containing keys in string format.public Optional<Object> getObjectValue(String key)
key - Indicates the key in String format, which can be null.Optional; returns
null if no such object is found.protected final <T> Optional<T> getObjectValue(String key, Class<T> clazz)
T - Template parameter.key - Indicates the key-value pair in String format, which can be null.clazz - Specifies the type of data.Optional; returns
null if no such object is found.public byte getByteValue(String key, byte defaultValue)
byte value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.byte value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public byte getByteValue(String key)
byte value matching a specified key.key - Indicates the key in String format, which can be null.byte value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public short getShortValue(String key, short defaultValue)
short value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.short value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public short getShortValue(String key)
short value matching a specified key.key - Indicates the key in String format, which can be null.short value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public int getIntValue(String key, int defaultValue)
int value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.int value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public int getIntValue(String key)
int value matching a specified key.key - Indicates the key in String format, which can be null.int value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public long getLongValue(String key, long defaultValue)
long value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.long value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public long getLongValue(String key)
long value matching a specified key.key - Indicates the key in String format, which can be null.long value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public float getFloatValue(String key, float defaultValue)
float value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.float value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public float getFloatValue(String key)
float value matching a specified key.key - Indicates the key in String format, which can be null.float value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public double getDoubleValue(String key, double defaultValue)
double value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.double value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public double getDoubleValue(String key)
double value matching a specified key.key - Indicates the key in String format, which can be null.double value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public boolean getBooleanValue(String key, boolean defaultValue)
boolean value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.boolean value matching the specified key; returns the defaultValue if no
value matching the key is found or a value of another type is found.public boolean getBooleanValue(String key)
boolean value matching a specified key.key - Indicates the key in String format, which can be null.boolean value matching the specified key; returns false if no value matching
the key is found or a value of another type is found.public char getChar(String key, char defaultValue)
char value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.char value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public char getChar(String key)
char value matching a specified key.key - Indicates the key in String format, which can be null.char value matching the specified key; returns 0 if no value matching the
key is found or a value of another type is found.public String getString(String key, String defaultValue)
String value matching a specified key.key - Indicates the key in String format, which can be null.defaultValue - Indicates the default value returned if no value matching the key is found or a value
of another type is found.String value matching the specified key; returns the defaultValue if no value
matching the key is found or a value of another type is found.public String getString(String key)
String value matching a specified key.key - Indicates the key in String format, which can be null.String value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public byte[] getByteValueArray(String key)
byte[] value matching a specified key.key - Indicates the key in String format, which can be null.byte[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public short[] getShortValueArray(String key)
short[] value matching a specified key.key - Indicates the key in String format, which can be null.short[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public int[] getIntValueArray(String key)
int[] value matching a specified key.key - Indicates the key in String format, which can be null.int[] value matching the specified key; returns null if no value matching the
key is found or a value of another type is found.public long[] getLongValueArray(String key)
long[] value matching a specified key.key - Indicates the key in String format, which can be null.long[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public float[] getFloatValueArray(String key)
float[] value matching a specified key.key - Indicates the key in String format, which can be null.float[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public double[] getDoubleValueArray(String key)
double[] value matching a specified key.key - Indicates the key in String format, which can be null.double[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public boolean[] getBooleanValueArray(String key)
boolean[] value matching a specified key.key - Indicates the key in String format, which can be null.boolean[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public char[] getCharArray(String key)
char[] value matching a specified key.key - Indicates the key in String format, which can be null.char[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public String[] getStringArray(String key)
String[] value matching a specified key.key - Indicates the key in String format, which can be null.String[] value matching the specified key; returns null if no value matching
the key is found or a value of another type is found.public int getSize()
public boolean isEmpty()
true if the current object is empty; returns false otherwise.public Set<String> getKeys()
public boolean hasKey(String key)
key - Indicates the key in String format, which can be null.true if the key is contained; returns false otherwise.public void remove(String key)
key - Indicates the key in String format, which can be null.public void clear()
public boolean marshalling(Parcel out)
Sequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be written.true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
Sequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been written.true if the unmarshalling is successful; returns false otherwise.public boolean equals(Object object)
Object
The equals method implements an equivalence relation
on non-null object references:
x, x.equals(x) should return
true.
x and y, x.equals(y)
should return true if and only if
y.equals(x) returns true.
x, y, and z, if
x.equals(y) returns true and
y.equals(z) returns true, then
x.equals(z) should return true.
x and y, multiple invocations of
x.equals(y) consistently return true
or consistently return false, provided no
information used in equals comparisons on the
objects is modified.
x,
x.equals(null) should return false.
The equals method for class Object implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x and
y, this method returns true if and only
if x and y refer to the same object
(x == y has the value true).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode method, which states
that equal objects must have equal hash codes.
equals 在类中 Objectobject - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
HashMappublic int hashCode()
ObjectHashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)protected Object clone() throws CloneNotSupportedException
Objectx, the expression:
will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x)
true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone. If a class and all of its superclasses (except
Object) obey this convention, it will be the case that
x.clone().getClass() == x.getClass().
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by super.clone before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by super.clone
need to be modified.
The method clone for class Object performs a
specific cloning operation. First, if the class of this object does
not implement the interface Cloneable, then a
CloneNotSupportedException is thrown. Note that all arrays
are considered to implement the interface Cloneable and that
the return type of the clone method of an array type T[]
is T[] where T is any reference or primitive type.
Otherwise, this method creates a new instance of the class of this
object and initializes all its fields with exactly the contents of
the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method
performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object does not itself implement the interface
Cloneable, so calling the clone method on an object
whose class is Object will result in throwing an
exception at run time.
clone 在类中 ObjectCloneNotSupportedException - if the object's class does not
support the Cloneable interface. Subclasses
that override the clone method can also
throw this exception to indicate that an instance cannot
be cloned.Cloneablepublic boolean hasFileDescriptor()
SequenceableSequenceable contains FileDescriptor object data.
If the custom Sequenceable class contains any FileDescriptor data, you should override this
method.
This method return false by default.
hasFileDescriptor 在接口中 Sequenceabletrue if it contains FileDescriptor data; returns false otherwise.