info.aduna.io.IOUtil.writeString()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中info.aduna.io.IOUtil.writeString()方法的一些代码示例,展示了IOUtil.writeString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtil.writeString()方法的具体详情如下:
包路径:info.aduna.io.IOUtil
类名称:IOUtil
方法名:writeString

IOUtil.writeString介绍

暂无

代码示例

代码示例来源:origin: info.aduna.appbase/aduna-appbase-core

/**
 * Save configuration settings to a file.
 * 
 * @param contents
 *        the configuration settings
 * @param file
 *        the file to write to
 * @throws IOException
 *         if the settings could not be saved because of an I/O problem
 */
public static void saveConfigurationContents(String contents, File file)
  throws IOException
{
  if (file.getParentFile().mkdirs() || file.getParentFile().canWrite()) {
    IOUtil.writeString(contents, file);
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-config

/**
 * Save configuration settings to a file.
 * 
 * @param contents
 *        the configuration settings
 * @param file
 *        the file to write to
 * @throws IOException
 *         if the settings could not be saved because of an I/O problem
 */
public static void saveConfigurationContents(String contents, File file)
  throws IOException
{
  if (file.getParentFile().mkdirs() || file.getParentFile().canWrite()) {
    IOUtil.writeString(contents, file);
  }
}

代码示例来源:origin: info.aduna.appbase/aduna-appbase-core

private File getConfigFile()
  throws IOException
{
  File f = new File(getConfDir(), LOGBACK_CONFIG_FILE);
  if (!f.exists() || !f.canRead()) {
    String content = ConfigurationUtil.loadConfigurationContents(LOGBACK_CONFIG_FILE);
    content = content.replace("${logging.main.file}", LOG_FILE);
    content = content.replace("${logging.event.user.file}", USER_EVENT_LOG_FILE);
    content = content.replace("${logging.event.admin.file}", ADMIN_EVENT_LOG_FILE);
    content = content.replace("${logging.event.user.logger}", USER_EVENT_LOGGER_NAME);
    content = content.replace("${logging.event.admin.logger}", ADMIN_EVENT_LOGGER_NAME);
    if (!f.getParentFile().mkdirs() && !f.getParentFile().canWrite()) {
      throw new IOException("Not allowed to write logging configuration file to " + f.getParent());
    }
    else {
      IOUtil.writeString(content, f);
    }
  }
  return f;
}

代码示例来源:origin: org.openrdf.sesame/sesame-config

private File getConfigFile()
  throws IOException
{
  File f = new File(getConfDir(), LOGBACK_CONFIG_FILE);
  if (!f.exists() || !f.canRead()) {
    String content = ConfigurationUtil.loadConfigurationContents(LOGBACK_CONFIG_FILE);
    content = content.replace("${logging.main.file}", LOG_FILE);
    content = content.replace("${logging.event.user.file}", USER_EVENT_LOG_FILE);
    content = content.replace("${logging.event.admin.file}", ADMIN_EVENT_LOG_FILE);
    content = content.replace("${logging.event.user.logger}", USER_EVENT_LOGGER_NAME);
    content = content.replace("${logging.event.admin.logger}", ADMIN_EVENT_LOGGER_NAME);
    if (!f.getParentFile().mkdirs() && !f.getParentFile().canWrite()) {
      throw new IOException("Not allowed to write logging configuration file to " + f.getParent());
    }
    else {
      IOUtil.writeString(content, f);
    }
  }
  return f;
}

相关文章