public class XWikiAttachmentContent extends Object implements Cloneable
Modifier | Constructor and Description |
---|---|
|
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) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
boolean |
exists() |
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).
|
long |
getLongSize() |
int |
getSize()
Deprecated.
since 9.0RC1, use
getLongSize() instead |
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.
|
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)
protected org.apache.commons.fileupload.FileItem getFileItem()
public long getId()
public void setId(long id)
id
- is ignored.@Deprecated public byte[] getContent()
getContentInputStream()
instead@Deprecated public void setContent(byte[] content)
setContent(java.io.InputStream, int)
insteadcontent
- 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 boolean exists()
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 streamIOException
- when an error occurs during streaming operationpublic void setContent(InputStream is) throws IOException
is
- the input stream that will be readIOException
- when an error occurs during streaming operation@Deprecated public int getSize()
getLongSize()
insteadpublic long getLongSize()
public void setOwnerDocument(XWikiDocument ownerDocument)
ownerDocument
- the owner document.Copyright © 2004–2022 XWiki. All rights reserved.