public class InMemoryUploadReceiver extends Object implements com.vaadin.ui.Upload.Receiver, com.vaadin.ui.Upload.StartedListener, com.vaadin.ui.Upload.ProgressListener
Upload.Receiver for an Upload component.
Stores the bytes in-memory, so be careful to limit the size of the uploads.| Modifier and Type | Field and Description |
|---|---|
protected Collection<String> |
acceptedMimeTypes |
protected String |
fileName |
protected boolean |
interrupted |
protected long |
maxFileSize |
protected String |
mimeType |
protected NotificationManager |
notificationManager |
protected ByteArrayOutputStream |
outputStream |
protected com.vaadin.ui.Upload |
upload |
| Constructor and Description |
|---|
InMemoryUploadReceiver(com.vaadin.ui.Upload upload,
long maxFileSize) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkFileSize(long receivedLength) |
protected void |
checkMimeType(String mimeType) |
byte[] |
getBytes() |
String |
getFileName() |
String |
getMimeType() |
protected void |
interrupt() |
boolean |
isInterruped() |
OutputStream |
receiveUpload(String filename,
String mimeType) |
void |
reset() |
void |
setAcceptedMimeTypes(Collection<String> acceptedMimeTypes)
By default, all mime types are accepted.
|
void |
updateProgress(long readBytes,
long contentLength) |
void |
uploadStarted(com.vaadin.ui.Upload.StartedEvent event) |
protected NotificationManager notificationManager
protected com.vaadin.ui.Upload upload
protected boolean interrupted
protected String fileName
protected String mimeType
protected long maxFileSize
protected ByteArrayOutputStream outputStream
protected Collection<String> acceptedMimeTypes
public InMemoryUploadReceiver(com.vaadin.ui.Upload upload,
long maxFileSize)
upload - The component that will serve this receivermaxFileSize - The maximum size of files that will be accepted (in bytes). -1 in case of no limit.public OutputStream receiveUpload(String filename, String mimeType)
receiveUpload in interface com.vaadin.ui.Upload.Receiverpublic void uploadStarted(com.vaadin.ui.Upload.StartedEvent event)
uploadStarted in interface com.vaadin.ui.Upload.StartedListenerpublic void updateProgress(long readBytes,
long contentLength)
updateProgress in interface com.vaadin.ui.Upload.ProgressListenerpublic byte[] getBytes()
public String getFileName()
public String getMimeType()
public boolean isInterruped()
protected void checkFileSize(long receivedLength)
protected void checkMimeType(String mimeType)
protected void interrupt()
public void setAcceptedMimeTypes(Collection<String> acceptedMimeTypes)
public void reset()
Copyright © 2016 Alfresco. All rights reserved.