Here you can find the source of inputStreamToFile(final InputStream inputStream, final File outputFile)
Parameter | Description |
---|---|
inputStream | The java.io.InputStream |
outputFile | The java.io.File to write to |
Parameter | Description |
---|---|
IOException | If an IO exception has occurred |
public static void inputStreamToFile(final InputStream inputStream, final File outputFile) throws IOException
//package com.java2s; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; public class Main { /**//w w w.j av a2s. c om * Reads from an {@link java.io.InputStream} and writes to a {@link java.io.File}. * Closes the {@link java.io.InputStream} when done. * * @param inputStream The {@link java.io.InputStream} * @param outputFile The {@link java.io.File} to write to * @throws IOException If an IO exception has occurred */ public static void inputStreamToFile(final InputStream inputStream, final File outputFile) throws IOException { Files.copy(inputStream, outputFile.toPath()); } }