public class FileUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FileUtils.TemporaryFileBlob
A Blob based on a File but whose contract says that the file is allowed to be moved to another filesystem
location if needed.
|
Modifier and Type | Method and Description |
---|---|
static Blob |
createSerializableBlob(InputStream file,
String filename,
String mimeType)
Creates a serializable blob from a stream, with filename and mimetype detection.
|
static Blob |
createTemporaryFileBlob(File file,
String filename,
String mimeType)
Creates a TemporaryFileBlob.
|
static String |
getCleanFileName(String filename)
Returns a clean filename, stripping upload path on client side.
|
static String |
retrieveFilename(javax.servlet.http.Part part)
Helper method to retrieve filename from part, waiting for servlet-api related improvements.
|
public static Blob createSerializableBlob(InputStream file, String filename, String mimeType)
Creates an in-memory blob if data is under 64K, otherwise constructs a serializable FileBlob which stores data in a temporary file on the hard disk.
file
- the input stream holding datafilename
- the file name. Will be set on the blob and will used for mimetype detection.mimeType
- the detected mimetype at upload. Can be null. Will be verified by the mimetype service.public static String retrieveFilename(javax.servlet.http.Part part)
Filename is cleaned before being returned.
getCleanFileName(String)
public static String getCleanFileName(String filename)
Fixes NXP-544
Copyright © 2015 Nuxeo SA. All rights reserved.