java.util.logging.Logger.loadResourceBundle()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(114)

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

Logger.loadResourceBundle介绍

[英]Load the specified resource bundle, use privileged code.
[中]加载指定的资源包,使用特权代码。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Initializes this logger's resource bundle.
 *
 * @throws IllegalArgumentException if this logger's resource bundle already
 *      exists and is different from the resource bundle specified.
 */
private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: robovm/robovm

private void readObject(ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    in.defaultReadObject();
    byte major = in.readByte();
    byte minor = in.readByte();
    // only check MAJOR version
    if (major != MAJOR) {
      throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
    }

    int length = in.readInt();
    if (length >= 0) {
      parameters = new Object[length];
      for (int i = 0; i < parameters.length; i++) {
        parameters[i] = in.readObject();
      }
    }
    if (resourceBundleName != null) {
      try {
        resourceBundle = Logger.loadResourceBundle(resourceBundleName);
      } catch (MissingResourceException e) {
        // Cannot find the specified resource bundle
        resourceBundle = null;
      }
    }
  }
}

代码示例来源:origin: robovm/robovm

if (bundleName != null) {
  try {
    record.setResourceBundle(loadResourceBundle(bundleName));
  } catch (MissingResourceException e) {

代码示例来源:origin: robovm/robovm

if (bundleName != null) {
  try {
    record.setResourceBundle(loadResourceBundle(bundleName));
  } catch (MissingResourceException e) {

代码示例来源:origin: robovm/robovm

if (bundleName != null) {
  try {
    record.setResourceBundle(loadResourceBundle(bundleName));
  } catch (MissingResourceException e) {

代码示例来源:origin: robovm/robovm

if (bundleName != null) {
  try {
    record.setResourceBundle(loadResourceBundle(bundleName));
  } catch (MissingResourceException e) {

代码示例来源:origin: com.jtransc/jtransc-rt

private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Initializes this logger's resource bundle.
 *
 * @throws IllegalArgumentException if this logger's resource bundle already
 *      exists and is different from the resource bundle specified.
 */
private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Initializes this logger's resource bundle.
 *
 * @throws IllegalArgumentException if this logger's resource bundle already
 *      exists and is different from the resource bundle specified.
 */
private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Initializes this logger's resource bundle.
 *
 * @throws IllegalArgumentException if this logger's resource bundle already
 *      exists and is different from the resource bundle specified.
 */
private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Initializes this logger's resource bundle.
 *
 * @throws IllegalArgumentException if this logger's resource bundle already
 *      exists and is different from the resource bundle specified.
 */
private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Initializes this logger's resource bundle.
 *
 * @throws IllegalArgumentException if this logger's resource bundle already
 *      exists and is different from the resource bundle specified.
 */
private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Initializes this logger's resource bundle.
 *
 * @throws IllegalArgumentException if this logger's resource bundle already
 *      exists and is different from the resource bundle specified.
 */
private synchronized void initResourceBundle(String resourceBundleName) {
  String current = this.resourceBundleName;
  if (current != null) {
    if (current.equals(resourceBundleName)) {
      return;
    } else {
      throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
    }
  }
  if (resourceBundleName != null) {
    this.resourceBundle = loadResourceBundle(resourceBundleName);
    this.resourceBundleName = resourceBundleName;
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg) {
  if (!internalIsLoggable(logLevel)) return;
  LogRecord record = new LogRecord(logLevel, msg);
  if (bundleName != null) {
    try {
      record.setResourceBundle(loadResourceBundle(bundleName));
    } catch (MissingResourceException e) {
      // ignore
    }
    record.setResourceBundleName(bundleName);
  }
  record.setLoggerName(this.name);
  record.setSourceClassName(sourceClass);
  record.setSourceMethodName(sourceMethod);
  log(record);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private void readObject(ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    in.defaultReadObject();
    byte major = in.readByte();
    byte minor = in.readByte();
    // only check MAJOR version
    if (major != MAJOR) {
      throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
    }

    int length = in.readInt();
    if (length >= 0) {
      parameters = new Object[length];
      for (int i = 0; i < parameters.length; i++) {
        parameters[i] = in.readObject();
      }
    }
    if (resourceBundleName != null) {
      try {
        resourceBundle = Logger.loadResourceBundle(resourceBundleName);
      } catch (MissingResourceException e) {
        // Cannot find the specified resource bundle
        resourceBundle = null;
      }
    }
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Throwable thrown) {
  if (!internalIsLoggable(logLevel)) return;
  LogRecord record = new LogRecord(logLevel, msg);
  if (bundleName != null) {
    try {
      record.setResourceBundle(loadResourceBundle(bundleName));
    } catch (MissingResourceException e) {
      // ignore
    }
    record.setResourceBundleName(bundleName);
  }
  record.setLoggerName(this.name);
  record.setSourceClassName(sourceClass);
  record.setSourceMethodName(sourceMethod);
  record.setThrown(thrown);
  log(record);
}

代码示例来源:origin: com.bugvm/bugvm-rt

private void readObject(ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    in.defaultReadObject();
    byte major = in.readByte();
    byte minor = in.readByte();
    // only check MAJOR version
    if (major != MAJOR) {
      throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
    }

    int length = in.readInt();
    if (length >= 0) {
      parameters = new Object[length];
      for (int i = 0; i < parameters.length; i++) {
        parameters[i] = in.readObject();
      }
    }
    if (resourceBundleName != null) {
      try {
        resourceBundle = Logger.loadResourceBundle(resourceBundleName);
      } catch (MissingResourceException e) {
        // Cannot find the specified resource bundle
        resourceBundle = null;
      }
    }
  }
}

代码示例来源:origin: MobiVM/robovm

private void readObject(ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    in.defaultReadObject();
    byte major = in.readByte();
    byte minor = in.readByte();
    // only check MAJOR version
    if (major != MAJOR) {
      throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
    }

    int length = in.readInt();
    if (length >= 0) {
      parameters = new Object[length];
      for (int i = 0; i < parameters.length; i++) {
        parameters[i] = in.readObject();
      }
    }
    if (resourceBundleName != null) {
      try {
        resourceBundle = Logger.loadResourceBundle(resourceBundleName);
      } catch (MissingResourceException e) {
        // Cannot find the specified resource bundle
        resourceBundle = null;
      }
    }
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object[] params) {
  if (!internalIsLoggable(logLevel)) return;
  LogRecord record = new LogRecord(logLevel, msg);
  if (bundleName != null) {
    try {
      record.setResourceBundle(loadResourceBundle(bundleName));
    } catch (MissingResourceException e) {
      // ignore
    }
    record.setResourceBundleName(bundleName);
  }
  record.setLoggerName(this.name);
  record.setSourceClassName(sourceClass);
  record.setSourceMethodName(sourceMethod);
  record.setParameters(params);
  log(record);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object param) {
  if (!internalIsLoggable(logLevel)) return;
  LogRecord record = new LogRecord(logLevel, msg);
  if (bundleName != null) {
    try {
      record.setResourceBundle(loadResourceBundle(bundleName));
    } catch (MissingResourceException e) {
      // ignore
    }
    record.setResourceBundleName(bundleName);
  }
  record.setLoggerName(this.name);
  record.setSourceClassName(sourceClass);
  record.setSourceMethodName(sourceMethod);
  record.setParameters(new Object[] { param });
  log(record);
}

相关文章