Class FilePart
java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.Part
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.PartBase
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.FilePart
- Direct Known Subclasses:
ContentTypeFilePart
This class implements a part of a Multipart post object that
consists of a file.
- Since:
- 2.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Default charset of file attachments.static final String
Default content encoding of file attachments.static final String
Default transfer encoding of file attachments.protected static final String
Attachment's file nameFields inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.Part
BOUNDARY, BOUNDARY_BYTES, CHARSET, CHARSET_BYTES, CONTENT_DISPOSITION, CONTENT_DISPOSITION_BYTES, CONTENT_TRANSFER_ENCODING, CONTENT_TRANSFER_ENCODING_BYTES, CONTENT_TYPE, CONTENT_TYPE_BYTES, CRLF, CRLF_BYTES, EXTRA, EXTRA_BYTES, QUOTE, QUOTE_BYTES
-
Constructor Summary
ConstructorDescriptionFilePart
(String name, PartSource partSource) FilePart Constructor.FilePart
(String name, PartSource partSource, String contentType, String charset) FilePart Constructor.FilePart Constructor.FilePart Constructor.FilePart Constructor.FilePart Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected PartSource
Returns the source of the file part.protected long
Return the length of the data.protected void
sendData
(OutputStream out) Write the data in "source" to the specified stream.protected void
Write the disposition header to the output streamMethods inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.PartBase
getCharSet, getContentType, getName, getTransferEncoding, setCharSet, setContentType, setName, setTransferEncoding
Methods inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.Part
getBoundary, getLengthOfParts, getLengthOfParts, getPartBoundary, isRepeatable, length, send, sendContentTypeHeader, sendEnd, sendEndOfHeader, sendParts, sendParts, sendStart, sendTransferEncodingHeader, toString
-
Field Details
-
DEFAULT_CONTENT_TYPE
Default content encoding of file attachments.- See Also:
-
DEFAULT_CHARSET
Default charset of file attachments.- See Also:
-
DEFAULT_TRANSFER_ENCODING
Default transfer encoding of file attachments.- See Also:
-
FILE_NAME
Attachment's file name- See Also:
-
-
Constructor Details
-
FilePart
FilePart Constructor. -
FilePart
FilePart Constructor.- Parameters:
name
- the name for this partpartSource
- the source for this part
-
FilePart
FilePart Constructor.- Parameters:
name
- the name of the file partfile
- the file to post- Throws:
FileNotFoundException
- if the file is not a normal file or if it is not readable.
-
FilePart
public FilePart(String name, File file, String contentType, String charset) throws FileNotFoundException FilePart Constructor.- Parameters:
name
- the name of the file partfile
- the file to postcontentType
- the content type for this part, ifnull
thedefault
is usedcharset
- the charset encoding for this part, ifnull
thedefault
is used- Throws:
FileNotFoundException
- if the file is not a normal file or if it is not readable.
-
FilePart
FilePart Constructor.- Parameters:
name
- the name of the file partfileName
- the file namefile
- the file to post- Throws:
FileNotFoundException
- if the file is not a normal file or if it is not readable.
-
FilePart
public FilePart(String name, String fileName, File file, String contentType, String charset) throws FileNotFoundException FilePart Constructor.- Parameters:
name
- the name of the file partfileName
- the file namefile
- the file to postcontentType
- the content type for this part, ifnull
thedefault
is usedcharset
- the charset encoding for this part, ifnull
thedefault
is used- Throws:
FileNotFoundException
- if the file is not a normal file or if it is not readable.
-
-
Method Details
-
sendDispositionHeader
Write the disposition header to the output stream- Overrides:
sendDispositionHeader
in classPart
- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs- See Also:
-
sendData
Write the data in "source" to the specified stream.- Specified by:
sendData
in classPart
- Parameters:
out
- The output stream.- Throws:
IOException
- if an IO problem occurs.- See Also:
-
getSource
Returns the source of the file part.- Returns:
- The source.
-
lengthOfData
Return the length of the data.- Specified by:
lengthOfData
in classPart
- Returns:
- The length.
- Throws:
IOException
- if an IO problem occurs- See Also:
-