![JAR search and dependency download from the Maven repository](/logo.png)
org.id4me.util.FileReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of relying-party-api Show documentation
Show all versions of relying-party-api Show documentation
ID4me RelyingParty API prototype
The newest version!
/*
*
* Copyright (C) 2018 Fonpit AG
*
*/
package org.id4me.util;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Path;
/**
* Provides file I/O functionality.
*
* @author Sven Woltmann
*/
public class FileReader {
private FileReader() {
// hide implicit public constructor of utility class
}
public static String readFileToString(Path path) throws IOException {
StringBuilder sb = new StringBuilder();
try (Reader reader = Files.newBufferedReader(path)) {
char[] buff = new char[8192];
int len;
while ((len = reader.read(buff)) > 0) {
sb.append(buff, 0, len);
}
}
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy