Example usage for org.apache.wicket.util.file Files writeTo

List of usage examples for org.apache.wicket.util.file Files writeTo

Introduction

In this page you can find the example usage for org.apache.wicket.util.file Files writeTo.

Prototype

public static int writeTo(final java.io.File file, final InputStream input, final int bufSize)
        throws IOException 

Source Link

Document

Writes the given input stream to the given file

Usage

From source file:au.org.theark.core.util.LoadCsvFileHelper.java

License:Open Source License

/**
 * Saves this file upload to a given file on the server side.
 * //from  w  w w  .  ja v  a2s.  c om
 * @param inputStream
 *            The input stream
 * @throws IOException
 */
public void writeToTempFile(final InputStream inputStream) throws IOException {
    log.info("Writing to temp file: " + temporaryFileName + ".tmp");
    File file = File.createTempFile(temporaryFileName, null);
    int bufSize = 4096;
    InputStream is = inputStream;
    try {
        Files.writeTo(file, is, bufSize);
    } finally {
        is.close();
    }
}