Java Code Examples for jdk.jfr.internal.SecuritySupport#newFileInputStream()

The following examples show how to use jdk.jfr.internal.SecuritySupport#newFileInputStream() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JFC.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String readContent(SafePath knownPath) throws IOException {
    if (SecuritySupport.getFileSize(knownPath) > MAXIMUM_FILE_SIZE) {
        throw new IOException("Configuration with more than "
                + MAXIMUM_FILE_SIZE + " characters can't be read.");
    }
    try (InputStream r = SecuritySupport.newFileInputStream(knownPath)) {
        return JFC.readContent(r);
    }
}
 
Example 2
Source File: JFC.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static String readContent(SafePath knownPath) throws IOException {
    if (SecuritySupport.getFileSize(knownPath) > MAXIMUM_FILE_SIZE) {
        throw new IOException("Configuration with more than "
                + MAXIMUM_FILE_SIZE + " characters can't be read.");
    }
    try (InputStream r = SecuritySupport.newFileInputStream(knownPath)) {
        return JFC.readContent(r);
    }
}
 
Example 3
Source File: JFC.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static String readContent(SafePath knownPath) throws IOException {
    if (SecuritySupport.getFileSize(knownPath) > MAXIMUM_FILE_SIZE) {
        throw new IOException("Configuration with more than "
                + MAXIMUM_FILE_SIZE + " characters can't be read.");
    }
    try (InputStream r = SecuritySupport.newFileInputStream(knownPath)) {
        return JFC.readContent(r);
    }
}