Java FileOutputStream Write saveToDisc(final InputStream fileInputStream, final String fileUploadPath)

Here you can find the source of saveToDisc(final InputStream fileInputStream, final String fileUploadPath)

Description

save To Disc

License

Open Source License

Declaration

public static void saveToDisc(final InputStream fileInputStream, final String fileUploadPath) throws IOException

    

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static final int BUFFER_SIZE = 1024;

    public static void saveToDisc(final InputStream fileInputStream, final String fileUploadPath) throws IOException

    {/*from   www  .j  a v  a2 s. com*/
        final OutputStream out = new FileOutputStream(new File(fileUploadPath));
        int read = 0;
        byte[] bytes = new byte[BUFFER_SIZE];
        while ((read = fileInputStream.read(bytes)) != -1) {
            out.write(bytes, 0, read);
        }
        out.flush();
        out.close();
    }
}

Related

  1. saveTextToFile(String fileName, String content)
  2. saveTo(InputStream in, String fileName)
  3. saveTo(String path, InputStream in)
  4. saveTo(String path, InputStream in)
  5. saveToBinaryFile(File dest, byte[] data)
  6. saveToDisk(InputStream is, String filename)
  7. saveToDisk(String contents, String filename)
  8. saveToEml(Message mail, File emlFile)
  9. saveToFile(byte[] data, String filename)