class TranslatorCompiler {

    File copyTranslatorScript() {
        final File tempFile = createTemporaryFile();
        try (final InputStream scriptInput = getScriptStream();
                OutputStreamWriter scriptOutput = new OutputStreamWriter(new FileOutputStream(tempFile),
                        Charset.forName("utf-8"))) {
            IOUtils.copy(scriptInput, scriptOutput, Charset.forName("utf-8"));
        } catch (final IOException e) {
            throw new RuntimeException("Failed to copy XML translator to local file.", e);
        }

        return tempFile;
    }

}