FileConfiguration.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:Thermos-Bukkit 作者:
/**
 * Loads this {@link FileConfiguration} from the specified reader.
 * <p>
 * All the values contained within this configuration will be removed,
 * leaving only settings and defaults, and the new values will be loaded
 * from the given stream.
 *
 * @param reader the reader to load from
 * @throws IOException thrown when underlying reader throws an IOException
 * @throws InvalidConfigurationException thrown when the reader does not
 *      represent a valid Configuration
 * @throws IllegalArgumentException thrown when reader is null
 */
public void load(Reader reader) throws IOException, InvalidConfigurationException {
    BufferedReader input = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);

    StringBuilder builder = new StringBuilder();

    try {
        String line;

        while ((line = input.readLine()) != null) {
            builder.append(line);
            builder.append('\n');
        }
    } finally {
        input.close();
    }

    loadFromString(builder.toString());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号