public class MockPart extends Object implements Part
javax.servlet.http.Part
.MockHttpServletRequest.addPart(javax.servlet.http.Part)
,
MockMultipartFile
Constructor and Description |
---|
MockPart(String name,
byte[] content)
Constructor for a part with byte[] content only.
|
MockPart(String name,
String filename,
byte[] content)
Constructor for a part with a filename and byte[] content.
|
Modifier and Type | Method and Description |
---|---|
void |
delete() |
String |
getContentType() |
String |
getHeader(String name) |
Collection<String> |
getHeaderNames() |
HttpHeaders |
getHeaders()
Return the
HttpHeaders backing header related accessor methods,
allowing for populating selected header entries. |
Collection<String> |
getHeaders(String name) |
InputStream |
getInputStream() |
String |
getName() |
long |
getSize() |
String |
getSubmittedFileName() |
void |
write(String fileName) |
public MockPart(String name, byte[] content)
getHeaders()
public MockPart(String name, String filename, byte[] content)
getHeaders()
public String getSubmittedFileName()
getSubmittedFileName
in interface Part
public String getContentType()
getContentType
in interface Part
public InputStream getInputStream() throws IOException
getInputStream
in interface Part
IOException
public void write(String fileName) throws IOException
write
in interface Part
IOException
public void delete() throws IOException
delete
in interface Part
IOException
public Collection<String> getHeaders(String name)
getHeaders
in interface Part
public Collection<String> getHeaderNames()
getHeaderNames
in interface Part
public final HttpHeaders getHeaders()
HttpHeaders
backing header related accessor methods,
allowing for populating selected header entries.