Example usage for org.apache.commons.io FileCleaningTracker track

List of usage examples for org.apache.commons.io FileCleaningTracker track

Introduction

In this page you can find the example usage for org.apache.commons.io FileCleaningTracker track.

Prototype

public void track(String path, Object marker) 

Source Link

Document

Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.

Usage

From source file:au.gov.ansto.bragg.nbi.restlet.fileupload.disk.DiskFileItemFactory.java

/**
 * Create a new {@link org.apache.commons.fileupload.disk.DiskFileItem}
 * instance from the supplied parameters and the local factory
 * configuration./*from w  ww  .j a  v  a2s.  c om*/
 *
 * @param fieldName   The name of the form field.
 * @param contentType The content type of the form field.
 * @param isFormField <code>true</code> if this is a plain form field;
 *                    <code>false</code> otherwise.
 * @param fileName    The name of the uploaded file, if any, as supplied
 *                    by the browser or other client.
 *
 * @return The newly created file item.
 */
public FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName) {
    DiskFileItem result = new DiskFileItem(fieldName, contentType, isFormField, fileName, sizeThreshold,
            repository);
    FileCleaningTracker tracker = getFileCleaningTracker();
    if (tracker != null) {
        tracker.track(result.getTempFile(), result);
    }
    return result;
}