org.alfresco.service.cmr.repository
Class ContentData

java.lang.Object
  extended by org.alfresco.service.cmr.repository.ContentData
All Implemented Interfaces:
java.io.Serializable

public class ContentData
extends java.lang.Object
implements java.io.Serializable

The compound property representing content

See Also:
Serialized Form

Constructor Summary
protected ContentData(ContentData original)
          Copy constructor for derived class
  ContentData(java.lang.String contentUrl, java.lang.String mimetype, long size, java.lang.String encoding)
          Create a content data using the default locale.
  ContentData(java.lang.String contentUrl, java.lang.String mimetype, long size, java.lang.String encoding, java.util.Locale locale)
          Create a compound set of data representing a single instance of content.
 
Method Summary
static ContentData createContentProperty(java.lang.String contentPropertyStr)
          Construct a content property from a string
 boolean equals(java.lang.Object obj)
           
 java.lang.String getContentUrl()
           
 java.lang.String getEncoding()
          Gets the content's encoding.
 java.lang.String getInfoUrl()
           
 java.util.Locale getLocale()
          Get the content's locale.
 java.lang.String 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, java.lang.String encoding)
          Constructs a new instance using the existing one as a template, but replacing the encoding.
static ContentData setMimetype(ContentData existing, java.lang.String mimetype)
          Constructs a new instance using the existing one as a template, but replacing the mimetype
 java.lang.String 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(java.lang.String contentUrl,
                   java.lang.String mimetype,
                   long size,
                   java.lang.String encoding)
Create a content data using the default locale.

See Also:
ContentData.ContentData(String, String, long, String, Locale)

ContentData

public ContentData(java.lang.String contentUrl,
                   java.lang.String mimetype,
                   long size,
                   java.lang.String encoding,
                   java.util.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(java.lang.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,
                                      java.lang.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,
                                      java.lang.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.

Parameters:
contentData - the content to check (may be null)
Returns:
true if the value is non-null

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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

getInfoUrl

public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.util.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 java.lang.Object
Returns:
hashCode


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.