Java Code Examples for jdk.jfr.internal.JVMSupport#ensureWithIOException()

The following examples show how to use jdk.jfr.internal.JVMSupport#ensureWithIOException() . 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: Configuration.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Reads a configuration from a file.
 *
 * @param path the file that contains the configuration, not {@code null}
 * @return the read {@link Configuration}, not {@code null}
 * @throws ParseException if the file can't be parsed
 * @throws IOException if the file can't be read
 * @throws SecurityException if a security manager exists and its
 *         {@code checkRead} method denies read access to the file.
 *
 * @see java.io.File#getPath()
 * @see java.lang.SecurityManager#checkRead(java.lang.String)
 */
public static Configuration create(Path path) throws IOException, ParseException {
    Objects.requireNonNull(path);
    JVMSupport.ensureWithIOException();
    try (Reader reader = Files.newBufferedReader(path)) {
        return JFC.create(JFC.nameFromPath(path), reader);
    }
}
 
Example 2
Source File: Configuration.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Reads a configuration from a file.
 *
 * @param path the file that contains the configuration, not {@code null}
 * @return the read {@link Configuration}, not {@code null}
 * @throws ParseException if the file can't be parsed
 * @throws IOException if the file can't be read
 * @throws SecurityException if a security manager exists and its
 *         {@code checkRead} method denies read access to the file.
 *
 * @see java.io.File#getPath()
 * @see java.lang.SecurityManager#checkRead(java.lang.String)
 */
public static Configuration create(Path path) throws IOException, ParseException {
    Objects.requireNonNull(path);
    JVMSupport.ensureWithIOException();
    try (Reader reader = Files.newBufferedReader(path)) {
        return JFC.create(JFC.nameFromPath(path), reader);
    }
}
 
Example 3
Source File: Configuration.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Reads a configuration from a file.
 *
 * @param path the file that contains the configuration, not {@code null}
 * @return the read {@link Configuration}, not {@code null}
 * @throws ParseException if the file can't be parsed
 * @throws IOException if the file can't be read
 * @throws SecurityException if a security manager exists and its
 *         {@code checkRead} method denies read access to the file.
 *
 * @see java.io.File#getPath()
 * @see java.lang.SecurityManager#checkRead(java.lang.String)
 */
public static Configuration create(Path path) throws IOException, ParseException {
    Objects.requireNonNull(path);
    JVMSupport.ensureWithIOException();
    try (Reader reader = Files.newBufferedReader(path)) {
        return JFC.create(JFC.nameFromPath(path), reader);
    }
}
 
Example 4
Source File: Configuration.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads a configuration from a reader.
 *
 * @param reader a reader that contains the configuration contents, not
 *        {@code null}
 * @return a configuration, not {@code null}
 * @throws IOException if an I/O error occurs while trying to read contents
 *         from the reader
 * @throws ParseException if the file can't be parsed
 */
public static Configuration create(Reader reader) throws IOException, ParseException {
    Objects.requireNonNull(reader);
    JVMSupport.ensureWithIOException();
    return JFC.create(null, reader);
}
 
Example 5
Source File: Configuration.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a predefined configuration.
 * <p>
 * See {@link Configuration#getConfigurations()} for available configuration
 * names.
 *
 * @param name the name of the configuration (for example, "default" or
 *        "profile")
 * @return a configuration, not {@code null}
 *
 * @throws IOException if a configuration with the given name does not
 *         exist, or if an I/O error occurs while reading the
 *         configuration file
 * @throws ParseException if the configuration file can't be parsed
 */
public static Configuration getConfiguration(String name) throws IOException, ParseException {
    JVMSupport.ensureWithIOException();
    return JFC.getPredefined(name);
}
 
Example 6
Source File: Configuration.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads a configuration from a character stream.
 *
 * @param reader a {@code Reader} that provides the configuration contents, not
 *        {@code null}
 * @return a configuration, not {@code null}
 * @throws IOException if an I/O error occurs while trying to read contents
 *         from the {@code Reader}
 * @throws ParseException if the file can't be parsed
 */
public static Configuration create(Reader reader) throws IOException, ParseException {
    Objects.requireNonNull(reader);
    JVMSupport.ensureWithIOException();
    return JFC.create(null, reader);
}
 
Example 7
Source File: Configuration.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a predefined configuration.
 * <p>
 * See {@link Configuration#getConfigurations()} for available configuration
 * names.
 *
 * @param name the name of the configuration (for example, {@code "default"} or
 *        {@code "profile"})
 * @return a configuration, not {@code null}
 *
 * @throws IOException if a configuration with the given name does not
 *         exist, or if an I/O error occurs while reading the
 *         configuration file
 * @throws ParseException if the configuration file can't be parsed
 */
public static Configuration getConfiguration(String name) throws IOException, ParseException {
    JVMSupport.ensureWithIOException();
    return JFC.getPredefined(name);
}
 
Example 8
Source File: Configuration.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Reads a configuration from a character stream.
 *
 * @param reader a {@code Reader} that provides the configuration contents, not
 *        {@code null}
 * @return a configuration, not {@code null}
 * @throws IOException if an I/O error occurs while trying to read contents
 *         from the {@code Reader}
 * @throws ParseException if the file can't be parsed
 */
public static Configuration create(Reader reader) throws IOException, ParseException {
    Objects.requireNonNull(reader);
    JVMSupport.ensureWithIOException();
    return JFC.create(null, reader);
}
 
Example 9
Source File: Configuration.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a predefined configuration.
 * <p>
 * See {@link Configuration#getConfigurations()} for available configuration
 * names.
 *
 * @param name the name of the configuration (for example, {@code "default"} or
 *        {@code "profile"})
 * @return a configuration, not {@code null}
 *
 * @throws IOException if a configuration with the given name does not
 *         exist, or if an I/O error occurs while reading the
 *         configuration file
 * @throws ParseException if the configuration file can't be parsed
 */
public static Configuration getConfiguration(String name) throws IOException, ParseException {
    JVMSupport.ensureWithIOException();
    return JFC.getPredefined(name);
}