Package org.alfresco.repo.jscript
Class ScriptNode.ScriptContentData
- java.lang.Object
-
- org.alfresco.repo.jscript.ScriptNode.ScriptContentData
-
- All Implemented Interfaces:
java.io.Serializable,org.springframework.extensions.surf.util.Content
- Enclosing class:
- ScriptNode
public class ScriptNode.ScriptContentData extends java.lang.Object implements org.springframework.extensions.surf.util.Content, java.io.SerializableInner class wrapping and providing access to a ContentData property- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ScriptContentData(org.alfresco.service.cmr.repository.ContentData contentData, org.alfresco.service.namespace.QName property)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Delete the content streamjava.lang.StringgetContent()java.lang.StringgetDownloadUrl()java.lang.StringgetEncoding()java.io.InputStreamgetInputStream()java.lang.StringgetMimetype()java.io.ReadergetReader()longgetSize()java.lang.StringgetUrl()voidguessEncoding()Guess the character encoding of a file.voidguessMimetype(java.lang.String filename)Guess the mimetype for the given filename - uses the extension to match on system mimetype mapbooleanisDirty()voidsetContent(java.lang.String content)Set the content streamvoidsetEncoding(java.lang.String encoding)voidsetMimetype(java.lang.String mimetype)voidwrite(java.io.InputStream inputStream)Set the content stream from another input stream.voidwrite(org.springframework.extensions.surf.util.Content content)Set the content stream from another content object.voidwrite(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding)Set the content stream from another content object.
-
-
-
Constructor Detail
-
ScriptContentData
public ScriptContentData(org.alfresco.service.cmr.repository.ContentData contentData, org.alfresco.service.namespace.QName property)Constructor- Parameters:
contentData- The ContentData object this object wrapsproperty- The property the ContentData is attached too
-
-
Method Detail
-
getContent
public java.lang.String getContent()
- Specified by:
getContentin interfaceorg.springframework.extensions.surf.util.Content
-
getInputStream
public java.io.InputStream getInputStream()
- Specified by:
getInputStreamin interfaceorg.springframework.extensions.surf.util.Content
-
getReader
public java.io.Reader getReader()
- Specified by:
getReaderin interfaceorg.springframework.extensions.surf.util.Content
-
isDirty
public boolean isDirty()
- Returns:
trueif the contentData has a binary (content URL) associated and the updates on contentData and related properties should be saved.falseif the contentData has a temporary value and no actual binary to be persisted.
-
setContent
public void setContent(java.lang.String content)
Set the content stream- Parameters:
content- Content string to set
-
write
public void write(org.springframework.extensions.surf.util.Content content)
Set the content stream from another content object.- Parameters:
content- ScriptContent to set
-
write
public void write(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding)Set the content stream from another content object.- Parameters:
content- ScriptContent to setapplyMimetype- If true, apply the mimetype from the Content object, else leave the original mimetypeguessEncoding- If true, guess the encoding from the underlying input stream, else use encoding set in the Content object as supplied.
-
write
public void write(java.io.InputStream inputStream)
Set the content stream from another input stream.- Parameters:
inputStream- InputStream
-
delete
public void delete()
Delete the content stream
-
getUrl
public java.lang.String getUrl()
- Returns:
- download URL to the content
-
getDownloadUrl
public java.lang.String getDownloadUrl()
- Returns:
- download URL to the content for a document item only
-
getSize
public long getSize()
- Specified by:
getSizein interfaceorg.springframework.extensions.surf.util.Content
-
getMimetype
public java.lang.String getMimetype()
- Specified by:
getMimetypein interfaceorg.springframework.extensions.surf.util.Content
-
getEncoding
public java.lang.String getEncoding()
- Specified by:
getEncodingin interfaceorg.springframework.extensions.surf.util.Content
-
setEncoding
public void setEncoding(java.lang.String encoding)
-
setMimetype
public void setMimetype(java.lang.String mimetype)
-
guessMimetype
public void guessMimetype(java.lang.String filename)
Guess the mimetype for the given filename - uses the extension to match on system mimetype map
-
guessEncoding
public void guessEncoding()
Guess the character encoding of a file. For non-text files UTF-8 default is applied, otherwise the appropriate encoding (such as UTF-16 or similar) will be appiled if detected.
-
-