org.apache.jackrabbit.value
Class ValueHelper

java.lang.Object
  extended byorg.apache.jackrabbit.value.ValueHelper

public class ValueHelper
extends Object

The ValueHelper class provides several Value related utility methods.


Method Summary
static Value[] convert(String[] srcValues, int targetType)
           
static Value convert(String srcValue, int targetType)
           
static Value[] convert(Value[] srcValues, int targetType)
           
static Value convert(Value srcValue, int targetType)
           
static Value copy(Value srcValue)
           
static Value[] copy(Value[] srcValues)
           
static Value deserialize(Reader reader, int type, boolean decodeBlanks)
          Deserializes the string data read from the given reader to a Value of the given type.
static Value deserialize(String value, int type, boolean decodeBlanks)
          Deserializes the given string to a Value of the given type.
static String serialize(Value value, boolean encodeBlanks)
          Serializes the given value to a String.
static void serialize(Value value, boolean encodeBlanks, Writer writer)
          Outputs the serialized value to a Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert

public static Value convert(String srcValue,
                            int targetType)
                     throws ValueFormatException,
                            IllegalArgumentException
Parameters:
srcValue -
targetType -
Returns:
Throws:
ValueFormatException
IllegalArgumentException

convert

public static Value[] convert(String[] srcValues,
                              int targetType)
                       throws ValueFormatException,
                              IllegalArgumentException
Parameters:
srcValues -
targetType -
Returns:
Throws:
ValueFormatException
IllegalArgumentException

convert

public static Value[] convert(Value[] srcValues,
                              int targetType)
                       throws ValueFormatException,
                              IllegalArgumentException
Parameters:
srcValues -
targetType -
Returns:
Throws:
ValueFormatException
IllegalArgumentException

convert

public static Value convert(Value srcValue,
                            int targetType)
                     throws ValueFormatException,
                            IllegalStateException,
                            IllegalArgumentException
Parameters:
srcValue -
targetType -
Returns:
Throws:
ValueFormatException
IllegalStateException
IllegalArgumentException

copy

public static Value copy(Value srcValue)
                  throws IllegalStateException
Parameters:
srcValue -
Returns:
Throws:
IllegalStateException

copy

public static Value[] copy(Value[] srcValues)
                    throws IllegalStateException
Parameters:
srcValues -
Returns:
Throws:
IllegalStateException

serialize

public static String serialize(Value value,
                               boolean encodeBlanks)
                        throws IllegalStateException,
                               RepositoryException
Serializes the given value to a 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.

Parameters:
value - the value to be serialized
encodeBlanks - if true space characters will be encoded as "_x0020_" within he output string.
Returns:
a string representation of the given value.
Throws:
IllegalStateException - if the given value is in an illegal state
RepositoryException - if an error occured during the serialization.

serialize

public static void serialize(Value value,
                             boolean encodeBlanks,
                             Writer writer)
                      throws IllegalStateException,
                             IOException,
                             RepositoryException
Outputs the serialized value to a 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.

Parameters:
value - the value to be serialized
encodeBlanks - if true space characters will be encoded as "_x0020_" within he output string.
writer - writer to output the encoded data
Throws:
IllegalStateException - if the given value is in an illegal state
IOException - if an i/o error occured during the serialization
RepositoryException - if an error occured during the serialization.

deserialize

public static Value deserialize(String value,
                                int type,
                                boolean decodeBlanks)
                         throws ValueFormatException,
                                RepositoryException
Deserializes the given string to a Value of the given type.

Parameters:
value - string to be deserialized
type - type of value
decodeBlanks - if true "_x0020_" character sequences will be decoded to single space characters each.
Returns:
the deserialized Value
Throws:
ValueFormatException - if the string data is not of the required format
RepositoryException - if an error occured during the deserialization.

deserialize

public static Value deserialize(Reader reader,
                                int type,
                                boolean decodeBlanks)
                         throws IOException,
                                ValueFormatException,
                                RepositoryException
Deserializes the string data read from the given reader to a Value of the given type.

Parameters:
reader - reader for the string data to be deserialized
type - type of value
decodeBlanks - if true "_x0020_" character sequences will be decoded to single space characters each.
Returns:
the deserialized Value
Throws:
IOException - if an i/o error occured during the serialization
ValueFormatException - if the string data is not of the required format
RepositoryException - if an error occured during the deserialization.


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.