public interface UploadedFile
<input type="file" name="name">
input field in a multipart form.Modifier and Type | Method and Description |
---|---|
byte[] |
asBytes()
Gets the file contents as a byte array.
|
File |
asFile()
Gets a copy of the file.
|
InputStream |
asStream()
Gets the uploaded file as a stream.
|
String |
asString()
Returns the contents of the file as a String, decoded using UTF-8
|
String |
contentType()
Gets the media type of the file as specified by the client, for example
image/jpeg |
String |
extension()
Gets the extension of the file as it was on the client's computer.
|
String |
filename()
Gets the original name of the file on the client's computer.
|
void |
saveTo(File dest)
Saves the file to the specified destination.
|
long |
size()
Gets the size of the file.
|
File asFile() throws IOException
IOException
- If an error while saving file.String asString() throws IOException
IOException
- If an error reading the file.byte[] asBytes() throws IOException
IOException
- If any error reading the bytes.String contentType()
image/jpeg
String filename()
String extension()
void saveTo(File dest) throws IOException
dest
- The destination to save to.IOException
- If there is an error saving the file.long size()
InputStream asStream() throws IOException
IOException
- If there is an error reading the file.Copyright © 2017–2020. All rights reserved.