Search in sources :

Example 1 with Files.readString

use of java.nio.file.Files.readString in project hedera-services by hashgraph.

the class ValidationScenarios method appropriateContents.

private static ByteString appropriateContents(long fileNum) {
    SysFileSerde<String> serde = SYS_FILE_SERDES.get(fileNum);
    String name = serde.preferredFileName();
    String loc = "files/" + params.getTargetNetwork() + "-" + name;
    try {
        var stylized = Files.readString(Paths.get(loc));
        return ByteString.copyFrom(serde.toRawFile(stylized));
    } catch (IOException e) {
        throw new IllegalStateException("Cannot read update file @ '" + loc + "'!", e);
    }
}
Also used : Files.readString(java.nio.file.Files.readString) ByteString(com.google.protobuf.ByteString) IOException(java.io.IOException)

Aggregations

ByteString (com.google.protobuf.ByteString)1 IOException (java.io.IOException)1 Files.readString (java.nio.file.Files.readString)1