throw new IOException("Attempting to write to a null file!");
throw new IllegalStateException("Attempting to write to a null file!");
    public static void writeInputStreamToFile(File file, InputStream stream) throws IOException {        if (file == null)            throw new IOException("Attempting to write to a null file!");        FileOutputStream out = new FileOutputStream(file);        //50 KBytes buffer        byte buf[] = new byte[1024 * 50];        int read = -1;        while ((read = stream.read(buf)) != -1) {            out.write(buf, 0, read);        }    }