JAVA-2116: Split or move libraries-data-2 module (#9716)

* JAVA-2116: Move Java-R Integration to libraries-6 module

* JAVA-2116: Move Guide to JMapper to libraries-data module
This commit is contained in:
kwoyke
2020-07-17 03:46:41 +02:00
committed by GitHub
parent 573fa1c3fa
commit 03c7d92e93
27 changed files with 79 additions and 75 deletions

View File

@@ -0,0 +1,33 @@
package com.baeldung.r;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Collectors;
/**
* Utility class for loading the script.R content.
*
* @author Donato Rimenti
*/
public class RUtils {
/**
* Loads the script.R and returns its content as a string.
*
* @return the script.R content as a string
* @throws IOException if any error occurs
* @throws URISyntaxException if any error occurs
*/
static String getMeanScriptContent() throws IOException, URISyntaxException {
URI rScriptUri = RUtils.class.getClassLoader()
.getResource("script.R")
.toURI();
Path inputScript = Paths.get(rScriptUri);
return Files.lines(inputScript)
.collect(Collectors.joining());
}
}