Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.service.cmr.repository
Class ContentData
java.lang.Object
  org.alfresco.service.cmr.repository.ContentData
All Implemented Interfaces:
Serializable

@org.alfresco.api.AlfrescoPublicApi
public class ContentData
extends Object
implements Serializable
The compound property representing content
Author:
Derek Hulley
See Also:
Serialized Form

Constructor Summary
ContentData(String contentUrl, String mimetype, long size, String encoding)
          Create a content data using the default 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
static ContentData
createContentProperty(String contentPropertyStr)
          Construct a content property from a string
boolean
equals(Object obj)
getContentUrl()
getEncoding()
          Gets the content's encoding.
getInfoUrl()
getLocale()
          Get the content's locale.
getMimetype()
          Gets content's mimetype.
long
getSize()
          Get the content's size
static 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 mimetype
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Constructor Detail
ContentData
protected ContentData(ContentData original)
Copy constructor for derived class
Parameters:
original - the object to copy

ContentData
public ContentData(String contentUrl,
                   String mimetype,
                   long size,
                   String encoding)
Create a content data using the default locale.
See Also:
ContentData(String, String, long, String, Locale)

ContentData
public ContentData(String contentUrl,
                   String mimetype,
                   long size,
                   String encoding,
                   Locale locale)
Create a compound set of data representing a single instance of content.

In order to ensure data integrity, the mimetype must be set if the content 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, the default locale will be used.
Method Detail
createContentProperty
public static ContentData createContentProperty(String contentPropertyStr)
Construct a content property from a string
Parameters:
contentPropertyStr - the string representing the content details
Returns:
Returns a bean version of the string

setMimetype
public static ContentData setMimetype(ContentData existing,
                                      String mimetype)
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 values
mimetype - the mimetype to set
Returns:
Returns a new, immutable instance of the data

setEncoding
public static ContentData setEncoding(ContentData existing,
                                      String encoding)
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 values
encoding - the encoding to set
Returns:
Returns a new, immutable instance of the data

hasContent
public static boolean hasContent(ContentData contentData)
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
public boolean equals(Object obj)
Overrides:
equals in class Object

toString
public String toString()
Overrides:
toString in class Object
Returns:
Returns a string of form: contentUrl=xxx|mimetype=xxx|size=xxx|encoding=xxx|locale=xxx

getInfoUrl
public String 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
public String 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
public String 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
public String getEncoding()
Gets the content's encoding.
Returns:
Returns a valid Java encoding, typically a character encoding, or null if the encoding is unkown

getLocale
public Locale getLocale()
Get the content's locale.
Returns:
Returns a locale, or null if the locale is unknown

hashCode
public int hashCode()
Overrides:
hashCode in class Object
Returns:
hashCode

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2018 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.