|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ning.http.multipart.Part
com.ning.http.multipart.PartBase
com.ning.http.multipart.FilePart
public class FilePart
This class is an adaptation of the Apache HttpClient implementation
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_CHARSET
Default charset of file attachments. |
static java.lang.String |
DEFAULT_CONTENT_TYPE
Default content encoding of file attachments. |
static java.lang.String |
DEFAULT_TRANSFER_ENCODING
Default transfer encoding of file attachments. |
protected static java.lang.String |
FILE_NAME
Attachment's file name |
Fields inherited from class com.ning.http.multipart.Part |
---|
BOUNDARY, CHARSET, CONTENT_DISPOSITION, CONTENT_TRANSFER_ENCODING, CONTENT_TYPE, CRLF, EXTRA, QUOTE |
Constructor Summary | |
---|---|
FilePart(java.lang.String name,
java.io.File file)
FilePart Constructor. |
|
FilePart(java.lang.String name,
java.io.File file,
java.lang.String contentType,
java.lang.String charset)
FilePart Constructor. |
|
FilePart(java.lang.String name,
PartSource partSource)
FilePart Constructor. |
|
FilePart(java.lang.String name,
PartSource partSource,
java.lang.String contentType,
java.lang.String charset)
FilePart Constructor. |
|
FilePart(java.lang.String name,
java.lang.String fileName,
java.io.File file)
FilePart Constructor. |
|
FilePart(java.lang.String name,
java.lang.String fileName,
java.io.File file,
java.lang.String contentType,
java.lang.String charset)
FilePart Constructor. |
Method Summary | |
---|---|
protected PartSource |
getSource()
Returns the source of the file part. |
protected long |
lengthOfData()
Return the length of the data. |
protected void |
sendData(java.io.OutputStream out)
Write the data in "source" to the specified stream. |
protected void |
sendDispositionHeader(java.io.OutputStream out)
Write the disposition header to the output stream |
Methods inherited from class com.ning.http.multipart.PartBase |
---|
getCharSet, getContentType, getName, getTransferEncoding, setCharSet, setContentType, setName, setTransferEncoding |
Methods inherited from class com.ning.http.multipart.Part |
---|
getBoundary, getLengthOfParts, getLengthOfParts, getPartBoundary, isRepeatable, length, send, sendContentTypeHeader, sendEnd, sendEndOfHeader, sendMessageEnd, sendPart, sendParts, sendParts, sendStart, sendTransferEncodingHeader, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_CONTENT_TYPE
public static final java.lang.String DEFAULT_CHARSET
public static final java.lang.String DEFAULT_TRANSFER_ENCODING
protected static final java.lang.String FILE_NAME
Constructor Detail |
---|
public FilePart(java.lang.String name, PartSource partSource, java.lang.String contentType, java.lang.String charset)
name
- the name for this partpartSource
- the source for this partcontentType
- the content type for this part, if null
the
default
is usedcharset
- the charset encoding for this part, if null
the
default
is usedpublic FilePart(java.lang.String name, PartSource partSource)
name
- the name for this partpartSource
- the source for this partpublic FilePart(java.lang.String name, java.io.File file) throws java.io.FileNotFoundException
name
- the name of the file partfile
- the file to post
java.io.FileNotFoundException
- if the file is not a normal
file or if it is not readable.public FilePart(java.lang.String name, java.io.File file, java.lang.String contentType, java.lang.String charset) throws java.io.FileNotFoundException
name
- the name of the file partfile
- the file to postcontentType
- the content type for this part, if null
the
default
is usedcharset
- the charset encoding for this part, if null
the
default
is used
java.io.FileNotFoundException
- if the file is not a normal
file or if it is not readable.public FilePart(java.lang.String name, java.lang.String fileName, java.io.File file) throws java.io.FileNotFoundException
name
- the name of the file partfileName
- the file namefile
- the file to post
java.io.FileNotFoundException
- if the file is not a normal
file or if it is not readable.public FilePart(java.lang.String name, java.lang.String fileName, java.io.File file, java.lang.String contentType, java.lang.String charset) throws java.io.FileNotFoundException
name
- the name of the file partfileName
- the file namefile
- the file to postcontentType
- the content type for this part, if null
the
default
is usedcharset
- the charset encoding for this part, if null
the
default
is used
java.io.FileNotFoundException
- if the file is not a normal
file or if it is not readable.Method Detail |
---|
protected void sendDispositionHeader(java.io.OutputStream out) throws java.io.IOException
sendDispositionHeader
in class Part
out
- The output stream
java.io.IOException
- If an IO problem occursprotected void sendData(java.io.OutputStream out) throws java.io.IOException
sendData
in class Part
out
- The output stream.
java.io.IOException
- if an IO problem occurs.protected PartSource getSource()
protected long lengthOfData() throws java.io.IOException
lengthOfData
in class Part
java.io.IOException
- if an IO problem occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |