public class ValueHelper
extends java.lang.Object
ValueHelper
class provides several Value
related utility methods.Modifier and Type | Method and Description |
---|---|
static void |
checkSupportedConversion(int fromType,
int toType) |
static Value[] |
convert(java.io.InputStream[] srcValues,
int targetType,
ValueFactory factory) |
static Value |
convert(java.io.InputStream srcValue,
int targetType,
ValueFactory factory) |
static Value[] |
convert(java.lang.String[] srcValues,
int targetType,
ValueFactory factory)
Same as
convert(String[], int, ValueFactory) using
ValueFactoryImpl . |
static Value |
convert(java.lang.String srcValue,
int targetType,
ValueFactory factory) |
static Value[] |
convert(Value[] srcValues,
int targetType,
ValueFactory factory) |
static Value |
convert(Value srcValue,
int targetType,
ValueFactory factory)
Converts the given value to a value of the specified target type.
|
static Value[] |
copy(Value[] srcValues,
ValueFactory factory) |
static Value |
copy(Value srcValue,
ValueFactory factory) |
static Value |
deserialize(java.io.Reader reader,
int type,
boolean decodeBlanks,
ValueFactory factory)
Deserializes the string data read from the given reader to a
Value of the given type. |
static Value |
deserialize(java.lang.String value,
int type,
boolean decodeBlanks,
ValueFactory factory)
Deserializes the given string to a
Value of the given type. |
static int |
getType(Value[] values)
Determine the
PropertyType of the passed values if all are of
the same type. |
static boolean |
isSupportedConversion(int fromType,
int toType) |
static java.lang.String |
serialize(Value value,
boolean encodeBlanks)
Serializes the given value to a
String . |
static void |
serialize(Value value,
boolean encodeBlanks,
boolean enforceBase64,
java.io.Writer writer)
Outputs the serialized value to a
Writer . |
public static boolean isSupportedConversion(int fromType, int toType)
public static void checkSupportedConversion(int fromType, int toType) throws ValueFormatException
ValueFormatException
public static Value convert(java.lang.String srcValue, int targetType, ValueFactory factory) throws ValueFormatException, java.lang.IllegalArgumentException
srcValue
- targetType
- factory
- ValueFormatException
java.lang.IllegalArgumentException
convert(Value, int, ValueFactory)
public static Value convert(java.io.InputStream srcValue, int targetType, ValueFactory factory) throws ValueFormatException, java.lang.IllegalArgumentException
srcValue
- targetType
- factory
- ValueFormatException
java.lang.IllegalArgumentException
public static Value[] convert(java.lang.String[] srcValues, int targetType, ValueFactory factory) throws ValueFormatException, java.lang.IllegalArgumentException
convert(String[], int, ValueFactory)
using
ValueFactoryImpl
.srcValues
- targetType
- ValueFormatException
java.lang.IllegalArgumentException
convert(Value, int, ValueFactory)
public static Value[] convert(java.io.InputStream[] srcValues, int targetType, ValueFactory factory) throws ValueFormatException, java.lang.IllegalArgumentException
srcValues
- targetType
- ValueFormatException
java.lang.IllegalArgumentException
convert(Value, int, ValueFactory)
public static Value[] convert(Value[] srcValues, int targetType, ValueFactory factory) throws ValueFormatException, java.lang.IllegalArgumentException
srcValues
- targetType
- factory
- ValueFormatException
java.lang.IllegalArgumentException
convert(Value, int, ValueFactory)
public static Value convert(Value srcValue, int targetType, ValueFactory factory) throws ValueFormatException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
srcValue
- targetType
- factory
- ValueFormatException
java.lang.IllegalStateException
java.lang.IllegalArgumentException
public static Value copy(Value srcValue, ValueFactory factory) throws java.lang.IllegalStateException
srcValue
- factory
- java.lang.IllegalStateException
public static Value[] copy(Value[] srcValues, ValueFactory factory) throws java.lang.IllegalStateException
srcValues
- factory
- java.lang.IllegalStateException
public static java.lang.String serialize(Value value, boolean encodeBlanks) throws java.lang.IllegalStateException, RepositoryException
String
. The serialization
format is the same as used by Document & System View XML, i.e.
binary values will be Base64-encoded whereas for all others
Value.getString()
will be used.value
- the value to be serializedencodeBlanks
- if true
space characters will be encoded
as "_x0020_"
within he output string.java.lang.IllegalStateException
- if the given value is in an illegal stateRepositoryException
- if an error occured during the serialization.public static void serialize(Value value, boolean encodeBlanks, boolean enforceBase64, java.io.Writer writer) throws java.lang.IllegalStateException, java.io.IOException, RepositoryException
Writer
. The serialization
format is the same as used by Document & System View XML, i.e.
binary values will be Base64-encoded whereas for all others
Value.getString()
will be used for serialization.value
- the value to be serializedencodeBlanks
- if true
space characters will be encoded
as "_x0020_"
within he output string.enforceBase64
- if true
, base64 encoding will always be usedwriter
- writer to output the encoded datajava.lang.IllegalStateException
- if the given value is in an illegal statejava.io.IOException
- if an i/o error occured during the
serializationRepositoryException
- if an error occured during the serialization.public static Value deserialize(java.lang.String value, int type, boolean decodeBlanks, ValueFactory factory) throws ValueFormatException, RepositoryException
Value
of the given type.value
- string to be deserializedtype
- type of valuedecodeBlanks
- if true
"_x0020_"
character sequences will be decoded to single space
characters each.factory
- ValueFactory used to build the Value
object.Value
ValueFormatException
- if the string data is not of the required
formatRepositoryException
- if an error occured during the
deserialization.public static Value deserialize(java.io.Reader reader, int type, boolean decodeBlanks, ValueFactory factory) throws java.io.IOException, ValueFormatException, RepositoryException
Value
of the given type.reader
- reader for the string data to be deserializedtype
- type of valuedecodeBlanks
- if true
"_x0020_"
character sequences will be decoded to single space
characters each.factory
- ValueFactory used to build the Value
object.Value
java.io.IOException
- if an i/o error occured during the
serializationValueFormatException
- if the string data is not of the required
formatRepositoryException
- if an error occured during the
deserialization.public static int getType(Value[] values) throws ValueFormatException
PropertyType
of the passed values if all are of
the same type.values
- array of values of the same typePropertyType.UNDEFINED
if values
is empty,
values[0].getType()
otherwise.ValueFormatException
- if not all values
are of the same typeCopyright © 2010 - 2020 Adobe. All Rights Reserved