|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelma.util.MimePart
public class MimePart
This represents a MIME part of a HTTP file upload
Constructor Summary | |
---|---|
MimePart(org.apache.commons.fileupload.FileItem fileItem)
Creates a new MimePart object from a file upload. |
|
MimePart(java.lang.String name,
byte[] content,
java.lang.String contentType)
Creates a new MimePart object. |
Method Summary | |
---|---|
byte[] |
getContent()
Return the content of the mime part as byte array. |
int |
getContentLength()
Get the number of bytes in the mime part's content |
java.lang.String |
getContentType()
|
java.lang.String |
getETag()
Get the ETag of the mime part |
java.io.InputStream |
getInputStream()
Return an InputStream to read the content of the mime part |
java.util.Date |
getLastModified()
Get the last modified date |
java.lang.String |
getName()
Get the mime part's name |
static java.lang.String |
getSubHeader(java.lang.String header,
java.lang.String subHeaderName)
Get a sub-header from a header, e.g. |
java.lang.String |
getText()
Return the content of the mime part as string, if its content type is null, text/* or application/text. |
static java.lang.String |
normalizeFilename(java.lang.String filename)
Normalize a upload file name. |
void |
setETag(java.lang.String eTag)
Set the ETag for the mime part |
void |
setLastModified(java.util.Date lastModified)
Set the last modified date |
java.lang.String |
writeToFile(java.lang.String dir)
Write the mimepart to a directory, using its name as file name. |
java.lang.String |
writeToFile(java.lang.String dir,
java.lang.String fname)
Write the mimepart to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MimePart(java.lang.String name, byte[] content, java.lang.String contentType)
name
- the file namecontent
- the mime part contentcontentType
- the content typepublic MimePart(org.apache.commons.fileupload.FileItem fileItem)
fileItem
- a commons fileupload file itemMethod Detail |
---|
public java.lang.String getContentType()
public int getContentLength()
public java.lang.String getName()
public byte[] getContent()
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
- an I/O related error occurredpublic java.lang.String getText()
public java.util.Date getLastModified()
public void setLastModified(java.util.Date lastModified)
lastModified
- the last modified datepublic java.lang.String getETag()
public void setETag(java.lang.String eTag)
eTag
- the ETagpublic java.lang.String writeToFile(java.lang.String dir)
dir
- the directory to write the file to
public java.lang.String writeToFile(java.lang.String dir, java.lang.String fname)
dir
- the directory to write the file to
public static java.lang.String getSubHeader(java.lang.String header, java.lang.String subHeaderName)
Content-Type: text/plain; charset="UTF-8"
public static java.lang.String normalizeFilename(java.lang.String filename)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |