public interface Segment
Segment
object represents a collection of header
values that is followed by a body. This is used to represent the
header of a multipart upload part. The raw value of each header
for the part can be acquired using this interface, also the type
and the disposition of the body can be determined from this.Part
Modifier and Type | Method and Description |
---|---|
long |
getContentLength()
This is a convenience method that can be used to determine
the length of the message body.
|
ContentType |
getContentType()
This is a convenience method that can be used to determine the
content type of the message body.
|
ContentDisposition |
getDisposition()
This is a convenience method that can be used to determine the
content type of the message body.
|
String |
getFileName()
This method is used to acquire the file name of the part.
|
String |
getName()
This method is used to acquire the name of the part.
|
String |
getTransferEncoding()
This is a convenience method that can be used to determine the
content type of the message body.
|
String |
getValue(String name)
This can be used to get the value of the first message header
that has the specified name.
|
String |
getValue(String name,
int index)
This can be used to get the value of the first message header
that has the specified name.
|
List<String> |
getValues(String name)
This can be used to get the values of HTTP message headers
that have the specified name.
|
boolean |
isFile()
This method is used to determine the type of a part.
|
boolean isFile()
String getName()
String getFileName()
String getValue(String name)
name
- the HTTP message header to get the value fromString getValue(String name, int index)
name
- the HTTP message header to get the value fromindex
- acquires a specific header value from multipleList<String> getValues(String name)
substring
and trim
calls.
The tokens returned by this method are ordered according to there HTTP quality values, or "q" values, see RFC 2616 section 3.9. This also strips out the quality parameter from tokens returned. So "image/html; q=0.9" results in "image/html". If there are no "q" values present then order is by appearance.
The result from this is either the trimmed header value, that is, the header value with no leading or trailing whitespace or an array of trimmed tokens ordered with the most preferred in the lower indexes, so index 0 is has highest preference.
name
- the name of the headers that are to be retrievedContentType getContentType()
Content-Type
header, if there is then
this will parse that header and represent it as a typed object
which will expose the various parts of the HTTP header.ContentDisposition getDisposition()
Content-Disposition
header, if there is
this will parse that header and represent it as a typed object
which will expose the various parts of the HTTP header.String getTransferEncoding()
Transfer-Encoding
header, if there is
then this will parse that header and return the first token in
the comma separated list of values, which is the primary value.long getContentLength()
Content-Length
header, if it does then the
length can be determined, if not then this returns -1.Copyright © 2024. All rights reserved.