Package com.redwood.scheduler.api.http
Interface Part
-
public interface Part
Modeled after Part from Servlet 3.0 spec
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
getByteArray()
Get the byte array for this file.String
getContentType()
Gets the content type of this part.String
getFileName()
Get the filename for this part if it is setString
getHeader(String name)
Get the header for the given name.Collection<String>
getHeaderNames()
Get all header names of this PartCollection<String>
getHeaders(String name)
get all headers for the given name.InputStream
getInputStream()
Gets the content of this part as an InputStreamString
getName()
Gets the name of this partlong
getSize()
Returns the size of this file.
-
-
-
Method Detail
-
getContentType
String getContentType()
Gets the content type of this part.- Returns:
- The content type of this part
-
getHeader
String getHeader(String name)
Get the header for the given name. The name is case insensitive. If the name does not exist, null is returned. If there are multiple headers with the given name, the first will be returned.- Parameters:
name
- to get the header for- Returns:
- The given header, null if it does not exist.
-
getHeaderNames
Collection<String> getHeaderNames()
Get all header names of this Part- Returns:
- A collection of all header names.
-
getHeaders
Collection<String> getHeaders(String name)
get all headers for the given name. The name is case insensitive.- Parameters:
name
- the name of the header- Returns:
- A (possibly empty) collection of all the headers for the given name.
-
getInputStream
InputStream getInputStream()
Gets the content of this part as an InputStream- Returns:
- The content of this part as an InputStream
-
getName
String getName()
Gets the name of this part- Returns:
- the name of this Part
-
getSize
long getSize()
Returns the size of this file.- Returns:
- The size of the file in bytes
-
getFileName
String getFileName()
Get the filename for this part if it is set- Returns:
- the filename, or null when there is no filename
-
getByteArray
byte[] getByteArray()
Get the byte array for this file. Use this only where inputstream can not be used, since it saves making another copy of the data.- Returns:
- data for this file.
-
-