|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xpn.xwiki.doc.XWikiAttachmentContent
public class XWikiAttachmentContent
The content of an attachment. Objects of this class hold the actual content which will be downloaded when a user downloads an attachment.
Constructor Summary | |
---|---|
|
XWikiAttachmentContent()
The default Constructor. |
|
XWikiAttachmentContent(XWikiAttachment attachment)
Constructor with associated attachment specified. |
|
XWikiAttachmentContent(XWikiAttachmentContent original)
Constructor which clones an existing XWikiAttachmentContent. |
protected |
XWikiAttachmentContent(XWikiAttachment attachment,
org.apache.commons.fileupload.FileItem f)
|
Method Summary | |
---|---|
Object |
clone()
|
XWikiAttachment |
getAttachment()
|
byte[] |
getContent()
Deprecated. use getContentInputStream() instead |
InputStream |
getContentInputStream()
|
OutputStream |
getContentOutputStream()
Set the content of the attachment by writing to a provided OutputStream. |
protected org.apache.commons.fileupload.FileItem |
getFileItem()
|
long |
getId()
This is used so that Hibernate will associate this content with the right attachment (metadata). |
int |
getSize()
|
boolean |
isContentDirty()
Is the content "dirty" meaning out of sync with the database. |
void |
setAttachment(XWikiAttachment attachment)
|
void |
setContent(byte[] content)
Deprecated. use setContent(java.io.InputStream, int) instead |
void |
setContent(InputStream is)
Set the content of the attachment from an InputStream. |
void |
setContent(InputStream is,
int len)
Set the content of the attachment from a portion of an InputStream. |
void |
setContentDirty(boolean contentDirty)
Set the content as "dirty" meaning out of sync with the database. |
void |
setId(long id)
This function does nothing and exists only for Hibernate to be able to load a value which is not used. |
void |
setOwnerDocument(XWikiDocument ownerDocument)
Set the owner document in order to propagate the content dirty flag. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XWikiAttachmentContent(XWikiAttachmentContent original)
clone()
.
original
- the XWikiAttachmentContent to clone.public XWikiAttachmentContent(XWikiAttachment attachment)
attachment
- the attachment which this is the content for.public XWikiAttachmentContent()
protected XWikiAttachmentContent(XWikiAttachment attachment, org.apache.commons.fileupload.FileItem f)
Method Detail |
---|
protected org.apache.commons.fileupload.FileItem getFileItem()
public long getId()
public void setId(long id)
id
- is ignored.public Object clone()
clone
in class Object
@Deprecated public byte[] getContent()
getContentInputStream()
instead
@Deprecated public void setContent(byte[] content)
setContent(java.io.InputStream, int)
instead
content
- a byte array containing the binary data of the attachmentpublic XWikiAttachment getAttachment()
public void setAttachment(XWikiAttachment attachment)
attachment
- which attachment (metadata) this content is to be associated with.public boolean isContentDirty()
public void setContentDirty(boolean contentDirty)
contentDirty
- if true then the content is regarded as out of sync with the database and in need of saving,
otherwise it's considered saved.public InputStream getContentInputStream()
public OutputStream getContentOutputStream()
getContentInputStream()
and copy
the content of that into the provided OutputStream. Before closing this OutputStream
the content will remain the old content prior to the change.
public void setContent(InputStream is, int len) throws IOException
is
- the input stream that will be readlen
- the number of bytes to read from the beginning of the stream
IOException
- when an error occurs during streaming operationpublic void setContent(InputStream is) throws IOException
is
- the input stream that will be read
IOException
- when an error occurs during streaming operationpublic int getSize()
public void setOwnerDocument(XWikiDocument ownerDocument)
ownerDocument
- the owner document.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |