|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.rmi.value.BinaryValue
public class BinaryValue
The BinaryValue
class implements the committed value state for
Binary values as a part of the State design pattern (Gof) used by this
package.
NOTE: This class forwards the InputStream
from which it was
created through the getStream()
method but does not close the
stream. It is the sole responsibility of the user of this value to close the
stream if not needed anymore to prevent memory loss.
This class implements readObject(ObjectInputStream)
and
writeObject(ObjectOutputStream)
methods to (de-)serialize the
data.
SerialValue
,
Serialized FormConstructor Summary | |
---|---|
protected |
BinaryValue(InputStream stream)
Creates an instance on the given InputStream . |
protected |
BinaryValue(String value)
Creates an instance providing the UTF-8 representation of the given string value. |
Method Summary | |
---|---|
boolean |
getBoolean()
Always throws IllegalStateException because only an
InputStream is available from this implementation. |
Calendar |
getDate()
Always throws IllegalStateException because only an
InputStream is available from this implementation. |
double |
getDouble()
Always throws IllegalStateException because only an
InputStream is available from this implementation. |
long |
getLong()
Always throws IllegalStateException because only an
InputStream is available from this implementation. |
InputStream |
getStream()
Returns the InputStream from which this instance has been
created. |
String |
getString()
Always throws IllegalStateException because only an
InputStream is available from this implementation. |
int |
getType()
Returns PropertyType.BINARY . |
protected static InputStream |
toStream(String value)
Helper method to convert a string value into an InputStream
from which the UTF-8 representation can be read. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected BinaryValue(InputStream stream)
InputStream
. This exact
stream will be provided by the getStream()
, thus care must be
taken to not inadvertendly read or close the stream.
stream
- The InputStream
providing the value.protected BinaryValue(String value) throws ValueFormatException
value
- The string whose UTF-8 representation is provided as the
value of this instance.
ValueFormatException
- If the platform does not support UTF-8
encoding (which is unlikely as UTF-8 is required to be available
on all platforms).Method Detail |
---|
protected static InputStream toStream(String value) throws ValueFormatException
InputStream
from which the UTF-8 representation can be read.
value
- The string value to be made available through a stream.
InputStream
from which the UTF-8 representation
of the value
may be read.
ValueFormatException
- If the platform does not support UTF-8
encoding (which is unlikely as UTF-8 is required to be available
on all platforms).public InputStream getStream()
InputStream
from which this instance has been
created.
getStream
in interface Value
public int getType()
PropertyType.BINARY
.
getType
in interface Value
public String getString() throws IllegalStateException
IllegalStateException
because only an
InputStream
is available from this implementation.
getString
in interface Value
IllegalStateException
- as defined above.public long getLong() throws IllegalStateException
IllegalStateException
because only an
InputStream
is available from this implementation.
getLong
in interface Value
IllegalStateException
- as defined above.public double getDouble() throws IllegalStateException
IllegalStateException
because only an
InputStream
is available from this implementation.
getDouble
in interface Value
IllegalStateException
- as defined above.public Calendar getDate() throws IllegalStateException
IllegalStateException
because only an
InputStream
is available from this implementation.
getDate
in interface Value
IllegalStateException
- as defined above.public boolean getBoolean() throws IllegalStateException
IllegalStateException
because only an
InputStream
is available from this implementation.
getBoolean
in interface Value
IllegalStateException
- as defined above.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |