com.atlassian.confluence.core
Class UploadedResource
java.lang.Object
com.atlassian.confluence.core.UploadedResource
- All Implemented Interfaces:
- AttachmentResource, org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource
- Direct Known Subclasses:
- UploadedResource
public class UploadedResource
- extends Object
- implements AttachmentResource
Resource wrapper for uploaded files. This will become extra handy once we get a better multipart file handling
e.g. Attachments handled entirely in memory
UploadedResource
public UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile)
UploadedResource
public UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile,
String comment)
UploadedResource
public UploadedResource(File file,
String filename,
String contentType,
String comment)
getDescription
public String getDescription()
- Specified by:
getDescription
in interface org.springframework.core.io.Resource
getFile
public File getFile()
- Specified by:
getFile
in interface org.springframework.core.io.Resource
getFilename
public String getFilename()
throws IllegalStateException
- Specified by:
getFilename
in interface org.springframework.core.io.Resource
- Throws:
IllegalStateException
getComment
public String getComment()
- Specified by:
getComment
in interface AttachmentResource
- Returns:
- the comment associated with the attachment or null if there is no comment
getInputStream
public InputStream getInputStream()
throws IOException
- Specified by:
getInputStream
in interface org.springframework.core.io.InputStreamSource
- Throws:
IOException
getContentType
public String getContentType()
- Specified by:
getContentType
in interface AttachmentResource
- Returns:
- the content/mime type of the attachment
getContentLength
public long getContentLength()
- Specified by:
getContentLength
in interface AttachmentResource
- Returns:
- the content length (size of the attachment)
exists
public boolean exists()
- Specified by:
exists
in interface org.springframework.core.io.Resource
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interface org.springframework.core.io.Resource
getURL
public URL getURL()
throws IOException
- Specified by:
getURL
in interface org.springframework.core.io.Resource
- Throws:
IOException
createRelative
public org.springframework.core.io.Resource createRelative(String relativePath)
throws IOException
- Specified by:
createRelative
in interface org.springframework.core.io.Resource
- Throws:
IOException
toString
public String toString()
- Overrides:
toString
in class Object
isReadable
public boolean isReadable()
- Specified by:
isReadable
in interface org.springframework.core.io.Resource
getURI
public URI getURI()
throws IOException
- Specified by:
getURI
in interface org.springframework.core.io.Resource
- Throws:
IOException
lastModified
public long lastModified()
throws IOException
- Specified by:
lastModified
in interface org.springframework.core.io.Resource
- Throws:
IOException