aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java b/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
index 6ce67aeac2..840433a11e 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
@@ -936,6 +936,13 @@ public class FileSystemUtils {
}
/**
+ * Reads the entire file using the given charset and returns the contents as a string
+ */
+ public static String readContent(Path inputFile, Charset charset) throws IOException {
+ return asByteSource(inputFile).asCharSource(charset).read();
+ }
+
+ /**
* Reads at most {@code limit} bytes from {@code inputFile} and returns it as a byte array.
*
* @throws IOException if there was an error.