Class ContentData
java.lang.Object
org.alfresco.service.cmr.repository.ContentData
- All Implemented Interfaces:
Serializable
The compound property representing content
- Author:
- Derek Hulley
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionContentData
(String contentUrl, String mimetype, long size, String encoding) Create a content data using thedefault locale
.ContentData
(String contentUrl, String mimetype, long size, String encoding, Locale locale) Create a compound set of data representing a single instance of content.protected
ContentData
(ContentData original) Copy constructor for derived class -
Method Summary
Modifier and TypeMethodDescriptionstatic ContentData
createContentProperty
(String contentPropertyStr) Construct a content property from a stringboolean
Gets the content's encoding.Get the content's locale.Gets content's mimetype.long
getSize()
Get the content's sizestatic boolean
hasContent
(ContentData contentData) Helper method to determine if the data represents any physical content or not.int
hashCode()
static ContentData
setEncoding
(ContentData existing, String encoding) Constructs a new instance using the existing one as a template, but replacing the encoding.static ContentData
setMimetype
(ContentData existing, String mimetype) Constructs a new instance using the existing one as a template, but replacing the mimetypetoString()
-
Constructor Details
-
ContentData
Copy constructor for derived class- Parameters:
original
- the object to copy
-
ContentData
Create a content data using thedefault locale
. -
ContentData
Create a compound set of data representing a single instance of content.In order to ensure data integrity, the
mimetype
must be set if thecontent URL
is set.- Parameters:
contentUrl
- the content URL. If this value is non-null, then the mimetype must be supplied.mimetype
- the content mimetype. This is mandatory if the contentUrl is specified.size
- the content size.encoding
- the content encoding. This is mandatory if the contentUrl is specified.locale
- the locale of the content (may be null). If null, thedefault locale
will be used.
-
-
Method Details
-
createContentProperty
Construct a content property from a string- Parameters:
contentPropertyStr
- the string representing the content details- Returns:
- Returns a bean version of the string
-
setMimetype
Constructs a new instance using the existing one as a template, but replacing the mimetype- Parameters:
existing
- an existing set of content data, null to use default valuesmimetype
- the mimetype to set- Returns:
- Returns a new, immutable instance of the data
-
setEncoding
Constructs a new instance using the existing one as a template, but replacing the encoding.- Parameters:
existing
- an existing set of content data, null to use default valuesencoding
- the encoding to set- Returns:
- Returns a new, immutable instance of the data
-
hasContent
Helper method to determine if the data represents any physical content or not.This method only cares if there is a binary (content URL) and makes no assumptions about the length of the binary.
- Parameters:
contentData
- the content to check (may be null)- Returns:
- true if the content URL is non-null i.e. there is a binary available
-
equals
-
toString
-
getInfoUrl
- Returns:
- Returns a URL containing information on the content including the mimetype,
locale, encoding and size, the string is returned in the form:
contentUrl=xxx|mimetype=xxx|size=xxx|encoding=xxx|locale=xxx
-
getContentUrl
- Returns:
- Returns a URL identifying the specific location of the content. The URL must identify, within the context of the originating content store, the exact location of the content.
- Throws:
ContentIOException
-
getMimetype
Gets content's mimetype.- Returns:
- Returns a standard mimetype for the content or null if the mimetype is unkown
-
getSize
public long getSize()Get the content's size- Returns:
- Returns the size of the content
-
getEncoding
Gets the content's encoding.- Returns:
- Returns a valid Java encoding, typically a character encoding, or null if the encoding is unkown
-
getLocale
Get the content's locale.- Returns:
- Returns a locale, or null if the locale is unknown
-
hashCode
public int hashCode()
-