Constructor and Description |
---|
FormItem(String name,
String fieldName,
boolean isFile,
String contentType,
byte[] content)
This constructor is used for testing.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Reads contents of a file into a byte array at once.
|
String |
getContentType()
Content type of this form field.
|
String |
getFieldName()
Form field name.
|
String |
getFileName()
File name.
|
InputStream |
getInputStream()
Returns input stream to read uploaded file contents from.
|
String |
getName()
File name.
|
String |
getStreamAsString()
Converts entire content of this item to String.
|
boolean |
isFile()
Returns true if this is a file, false if not.
|
boolean |
isFormField()
returns true if this is a form field, false if not.
|
void |
saveTo(String path)
Saves content of this item to a file.
|
public FormItem(String name, String fieldName, boolean isFile, String contentType, byte[] content)
name
- name of a file.fieldName
- name of a field.isFile
- true if this is a file, false if not.contentType
- content type for this file.content
- content in bytes.public String getName()
public String getFileName()
public String getFieldName()
public boolean isFile()
public String getContentType()
public boolean isFormField()
public InputStream getInputStream()
public String getStreamAsString()
public byte[] getBytes()
public void saveTo(String path) throws IOException
path
- to fileIOException
Copyright © 2020 JavaLite. All rights reserved.