private File writeTempFile(@NonNull String data) throws AlgoliaException {
        try {
            // Create temporary file.
            File tmpDir = client.getTempDir();
            File tmpFile = File.createTempFile("algolia.", ".json", tmpDir);

            // Write to file.
            Writer writer = new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8");
            writer.write(data);
            writer.close();

            return tmpFile;
        } catch (IOException e) {
            throw new AlgoliaException("Could not create temporary file", e);
        }
    }
private File writeTempFile(@NonNull String data) throws AlgoliaException {
        try {
            
            File tmpDir = client.getTempDir();
            File tmpFile = File.createTempFile("algolia.", ".json", tmpDir);

            
            Writer writer = new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8");
            writer.write(data);
            writer.close();

            return tmpFile;
        } catch (IOException e) {
            throw new AlgoliaException("Could not create temporary file", e);
        }
    }
private File writeTempFile ( @ NonNull String data ) throws AlgoliaException { try { // Create temporary file. File tmpDir = client . getTempDir ( ) ; File tmpFile = File . createTempFile ( "algolia." , ".json" , tmpDir ) ; // Write to file. Writer writer = new OutputStreamWriter ( new FileOutputStream ( tmpFile ) , "UTF-8" ) ; writer . write ( data ) ; writer . close ( ) ; return tmpFile ; } catch ( IOException e ) { throw new AlgoliaException ( "Could not create temporary file" , e ) ; } }
Write a temporary file containing textual data in UTF-8 encoding.

@param data Data to write.
@return Path to the created file.
@throws AlgoliaException
Write a temporary file containing textual data in UTF - 8 encoding .