Package org.apache.jackrabbit.value
Class BinaryValue
- java.lang.Object
-
- org.apache.jackrabbit.value.BaseValue
-
- org.apache.jackrabbit.value.BinaryValue
-
-
Field Summary
Fields Modifier and Type Field Description static int
TYPE
-
Constructor Summary
Constructors Constructor Description BinaryValue(byte[] data)
Constructs aBinaryValue
object based on a byte array.BinaryValue(java.io.InputStream stream)
Constructs aBinaryValue
object based on a stream.BinaryValue(java.lang.String text)
Constructs aBinaryValue
object based on a string.BinaryValue(Binary bin)
Constructs aBinaryValue
object based on aBinary
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.Binary
getBinary()
Returns aBinary
representation of this value.java.lang.String
getInternalString()
Gets the string representation of this binary value.java.io.InputStream
getStream()
Returns anInputStream
representation of this value.int
hashCode()
Returns zero to satisfy the Object equals/hashCode contract.-
Methods inherited from class org.apache.jackrabbit.value.BaseValue
getBoolean, getDate, getDecimal, getDouble, getLong, getString, getType
-
-
-
-
Field Detail
-
TYPE
public static final int TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinaryValue
public BinaryValue(java.lang.String text)
Constructs aBinaryValue
object based on a string.- Parameters:
text
- the string thisBinaryValue
should represent
-
BinaryValue
public BinaryValue(Binary bin)
Constructs aBinaryValue
object based on aBinary
.- Parameters:
bin
- the bytes thisBinaryValue
should represent
-
BinaryValue
public BinaryValue(java.io.InputStream stream)
Constructs aBinaryValue
object based on a stream.- Parameters:
stream
- the stream thisBinaryValue
should represent
-
BinaryValue
public BinaryValue(byte[] data)
Constructs aBinaryValue
object based on a byte array.- Parameters:
data
- the bytes thisBinaryValue
should represent
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.The result is
true
if and only if the argument is notnull
and is aBinaryValue
object that represents the same value as this object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the reference object with which to compare.- Returns:
true
if this object is the same as the obj argument;false
otherwise.
-
hashCode
public int hashCode()
Returns zero to satisfy the Object equals/hashCode contract. This class is mutable and not meant to be used as a hash key.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- always zero
- See Also:
Object.hashCode()
-
getInternalString
public java.lang.String getInternalString() throws ValueFormatException, RepositoryException
Gets the string representation of this binary value.- Returns:
- string representation of this binary value.
- Throws:
ValueFormatException
RepositoryException
- if another error occurs
-
getStream
public java.io.InputStream getStream() throws java.lang.IllegalStateException, RepositoryException
Returns anInputStream
representation of this value. Uses the standard conversion to binary (see JCR specification).It is the responsibility of the caller to close the returned
InputStream
.- Specified by:
getStream
in interfaceValue
- Overrides:
getStream
in classBaseValue
- Returns:
- An
InputStream
representation of this value. - Throws:
RepositoryException
- if an error occurs.java.lang.IllegalStateException
-
getBinary
public Binary getBinary() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns aBinary
representation of this value. TheBinary
object in turn provides methods to access the binary data itself. Uses the standard conversion to binary (see JCR specification).- Specified by:
getBinary
in interfaceValue
- Overrides:
getBinary
in classBaseValue
- Returns:
- A
Binary
representation of this value. - Throws:
RepositoryException
- if an error occurs.ValueFormatException
java.lang.IllegalStateException
-
-