algoliasearch/src/offline/java/com/algolia/search/saas/FileUtils.java
public static void writeFile(@NonNull File destinationFile, @NonNull InputStream content) throws IOException {
        byte[] buffer = new byte[64 * 1024]; // 64 kB buffer
        FileOutputStream outputStream = new FileOutputStream(destinationFile);
        try {
            int bytesRead;
            while ((bytesRead = content.read(buffer)) >= 0) {
                outputStream.write(buffer, 0, bytesRead);
            }
        } finally {
            content.close();
            outputStream.close();
        }
    }
public static void writeFile(@NonNull File destinationFile, @NonNull InputStream content) throws IOException {
        byte[] buffer = new byte[64 * 1024]; // 64 kB buffer
        FileOutputStream outputStream = new FileOutputStream(destinationFile);
        try {
            int bytesRead;
            while ((bytesRead = content.read(buffer)) >= 0) {
                outputStream.write(buffer, 0, bytesRead);
            }
        } finally {
            content.close();
            outputStream.close();
        }
    }
public static void writeFile ( @ NonNull File destinationFile , @ NonNull InputStream content ) throws IOException { byte [ ] buffer = new byte [ 64 * 1024 ] ; // 64 kB buffer FileOutputStream outputStream = new FileOutputStream ( destinationFile ) ; try { int bytesRead ; while ( ( bytesRead = content . read ( buffer ) ) >= 0 ) { outputStream . write ( buffer , 0 , bytesRead ) ; } } finally { content . close ( ) ; outputStream . close ( ) ; } }
Write a stream of bytes to a file.

@param destinationFile The file to be written to. The parent directory must exist. If the file already exists,
it will be overwritten.
@param content The bytes to write.
@throws IOException if anything goes wrong.
Write a stream of bytes to a file .