|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bea.content.BinaryValue
public class BinaryValue
This class represents binary content. It contains the binary data along with binary metadata.
A BinaryValue must always contain the contentType, name and size.
A size of -1 means that that the size was not available when this object was constructed. Once the value has been persisted, the size will be available.
The stream representing the binary content may not be present depending on the
underlying repository and SPI implementation. If the stream is not present, they can be retrieved via
INodeManager.getStream(ContentContext, ID, String)
for Property values and ITypeManager.getStream(ContentContext, ID, ID)
for PropertyChoice values.
A BinaryValue's name should be a single filename element and therefore should not include path separator characters (either / or \.) These characters have specific meaning to filesystems and may cause trouble should this binary be persisted to the filesystem by its name.
For SPI implementors: After using a BinaryValue, it is necessary to close the value InputStream.
Constructor Summary | |
---|---|
BinaryValue()
Constructs an empty BinaryValue. |
|
BinaryValue(String contentType,
String name,
InputStream value)
Constructs a full BinaryValue. |
|
BinaryValue(String contentType,
String name,
int size)
Constructs a BinaryValue without the stream. |
|
BinaryValue(String contentType,
String name,
int size,
InputStream value)
Constructs a full BinaryValue. |
|
BinaryValue(String contentType,
String name,
int size,
InputStream value,
String checksum)
Construct a BinaryValue object with a checksum. |
Method Summary | |
---|---|
Object |
clone()
Clones a BinaryValue. |
boolean |
equals(Object obj)
Indicates whether some other BinaryValue is "equal to" this one. |
String |
getChecksum()
Get the checksum for this value. |
String |
getContentType()
Gets the content type for the binary data. |
String |
getName()
Gets the filename for the binary data, including the file extension. |
int |
getSize()
Returns the size in bytes, or -1 if the size is not available. |
InputStream |
getValue()
Gets the binary data. |
int |
hashCode()
Returns a hash code value for this binary value. |
boolean |
isChecksumManuallySet()
If the setChecksum(String) method is called this will return true. |
void |
setChecksum(String checksum)
This will set the checksum for this binary data. |
void |
setContentType(String contentType)
Sets the content type for the binary data. |
void |
setName(String name)
Sets the filename for the binary data, including the file extension. |
void |
setSize(int size)
Sets the size in bytes, specify -1 if unknown. |
void |
setValue(InputStream value)
Sets the binary data. |
String |
toString()
Returns the BinaryValue's name as a String. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BinaryValue(String contentType, String name, int size, InputStream value, String checksum)
contentType
- - must have the mimeType and optionally
the charset in format "mimetypevalue;charset=charsetvalue".
For example, "text/html;charset=iso-8859-1"name
- - the filename including the extension. For example, foo.htmlsize
- - the size in bytes of the binary data. Specify -1 if unknown. The size is calculated at
create and update time when using the WLP Repository. A value given to this constructor will be ignored
by the WLP Repository. Other SPI implementations may chose to populate or ignore this field.value
- - the the binary data as a an InputStream.checksum
- - the checksum of the binary data. The checksum is calculated at create and update time when
using the WLP Repository. A value given to this constructor will be ignored by the WLP Repository. Other SPI
implementations may chose to populate or ignore this field.public BinaryValue()
public BinaryValue(String contentType, String name, int size)
contentType
- - must have the mimeType and optionally
the charset in format "mimetypevalue;charset=charsetvalue".
For example, "text/html;charset=iso-8859-1"name
- - the filename including the extension. For example, foo.htmlsize
- - the size in bytes of the binary data. Specify -1 if unknown. The size is calculated at
create and update time when using the WLP Repository. A value given to this constructor will be ignored
by the WLP Repository. Other SPI implementations may chose to populate or ignore this field.public BinaryValue(String contentType, String name, int size, InputStream value)
contentType
- - must have the mimeType and optionally
the charset in format "mimetypevalue;charset=charsetvalue".
For example, "text/html;charset=iso-8859-1"name
- - the filename including the extension. For example, foo.htmlsize
- - the size in bytes of the binary data. Specify -1 if unknown. The size is calculated at
create and update time when using the WLP Repository. A value given to this constructor will be ignored
by the WLP Repository. Other SPI implementations may chose to populate or ignore this field.value
- - the the binary data as a an InputStream.public BinaryValue(String contentType, String name, InputStream value)
contentType
- - must have the mimeType and optionally
the charset in format "mimetypevalue;charset=charsetvalue".
For example, "text/html;charset=iso-8859-1"name
- - the filename including the extension. For example, foo.htmlvalue
- - the the binary data as a an InputStream.Method Detail |
---|
public String getContentType()
public void setContentType(String contentType)
contentType
- the content type of the binary data.public String getName()
public void setName(String name)
name
- The name of the binary data.public InputStream getValue()
WARNING: If using this interface to retrieve binary content from a WLP Repository, please read the javadoc
for RepositoryConfig
. BinaryValue objects returned from the
WLP Repository will not include the value. The value can be retrieved using
INodeManager.getStream(ContentContext, ID, String)
for Property values on
published nodes, IVersionManager.getStream(ContentContext, ID, ID)
for Property
values on versions and ITypeManager.getStream(ContentContext, ID, ID)
for
PropertyChoice values.
public void setValue(InputStream value)
value
- The value to set.public int getSize()
public void setSize(int size)
size
- The size in bytes of the binary data.public String toString()
toString
in class Object
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- If the clone fails.public String getChecksum()
public void setChecksum(String checksum)
checksum
- the checksum to set.public boolean isChecksumManuallySet()
setChecksum(String)
method is called this will return true. It is an indication to the
underlying repository implementation that the user has explicitly set the checksum.
If using a WLP Repository users are encouraged not to set the checksum explicitly
and to allow the repository to fill in the checksum.
setChecksum(String)
method has been called, false otherwise.public boolean equals(Object obj)
equals
in class Object
obj
- the reference object with which to compare.
public int hashCode()
hashCode
in class Object
|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |