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

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

本文整理了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

  1. /**
  2. * Initializes this logger's resource bundle.
  3. *
  4. * @throws IllegalArgumentException if this logger's resource bundle already
  5. * exists and is different from the resource bundle specified.
  6. */
  7. private synchronized void initResourceBundle(String resourceBundleName) {
  8. String current = this.resourceBundleName;
  9. if (current != null) {
  10. if (current.equals(resourceBundleName)) {
  11. return;
  12. } else {
  13. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  14. }
  15. }
  16. if (resourceBundleName != null) {
  17. this.resourceBundle = loadResourceBundle(resourceBundleName);
  18. this.resourceBundleName = resourceBundleName;
  19. }
  20. }

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

  1. private void readObject(ObjectInputStream in) throws IOException,
  2. ClassNotFoundException {
  3. in.defaultReadObject();
  4. byte major = in.readByte();
  5. byte minor = in.readByte();
  6. // only check MAJOR version
  7. if (major != MAJOR) {
  8. throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
  9. }
  10. int length = in.readInt();
  11. if (length >= 0) {
  12. parameters = new Object[length];
  13. for (int i = 0; i < parameters.length; i++) {
  14. parameters[i] = in.readObject();
  15. }
  16. }
  17. if (resourceBundleName != null) {
  18. try {
  19. resourceBundle = Logger.loadResourceBundle(resourceBundleName);
  20. } catch (MissingResourceException e) {
  21. // Cannot find the specified resource bundle
  22. resourceBundle = null;
  23. }
  24. }
  25. }
  26. }

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

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

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

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

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

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

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

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

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

  1. private synchronized void initResourceBundle(String resourceBundleName) {
  2. String current = this.resourceBundleName;
  3. if (current != null) {
  4. if (current.equals(resourceBundleName)) {
  5. return;
  6. } else {
  7. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  8. }
  9. }
  10. if (resourceBundleName != null) {
  11. this.resourceBundle = loadResourceBundle(resourceBundleName);
  12. this.resourceBundleName = resourceBundleName;
  13. }
  14. }

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

  1. /**
  2. * Initializes this logger's resource bundle.
  3. *
  4. * @throws IllegalArgumentException if this logger's resource bundle already
  5. * exists and is different from the resource bundle specified.
  6. */
  7. private synchronized void initResourceBundle(String resourceBundleName) {
  8. String current = this.resourceBundleName;
  9. if (current != null) {
  10. if (current.equals(resourceBundleName)) {
  11. return;
  12. } else {
  13. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  14. }
  15. }
  16. if (resourceBundleName != null) {
  17. this.resourceBundle = loadResourceBundle(resourceBundleName);
  18. this.resourceBundleName = resourceBundleName;
  19. }
  20. }

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

  1. /**
  2. * Initializes this logger's resource bundle.
  3. *
  4. * @throws IllegalArgumentException if this logger's resource bundle already
  5. * exists and is different from the resource bundle specified.
  6. */
  7. private synchronized void initResourceBundle(String resourceBundleName) {
  8. String current = this.resourceBundleName;
  9. if (current != null) {
  10. if (current.equals(resourceBundleName)) {
  11. return;
  12. } else {
  13. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  14. }
  15. }
  16. if (resourceBundleName != null) {
  17. this.resourceBundle = loadResourceBundle(resourceBundleName);
  18. this.resourceBundleName = resourceBundleName;
  19. }
  20. }

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

  1. /**
  2. * Initializes this logger's resource bundle.
  3. *
  4. * @throws IllegalArgumentException if this logger's resource bundle already
  5. * exists and is different from the resource bundle specified.
  6. */
  7. private synchronized void initResourceBundle(String resourceBundleName) {
  8. String current = this.resourceBundleName;
  9. if (current != null) {
  10. if (current.equals(resourceBundleName)) {
  11. return;
  12. } else {
  13. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  14. }
  15. }
  16. if (resourceBundleName != null) {
  17. this.resourceBundle = loadResourceBundle(resourceBundleName);
  18. this.resourceBundleName = resourceBundleName;
  19. }
  20. }

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

  1. /**
  2. * Initializes this logger's resource bundle.
  3. *
  4. * @throws IllegalArgumentException if this logger's resource bundle already
  5. * exists and is different from the resource bundle specified.
  6. */
  7. private synchronized void initResourceBundle(String resourceBundleName) {
  8. String current = this.resourceBundleName;
  9. if (current != null) {
  10. if (current.equals(resourceBundleName)) {
  11. return;
  12. } else {
  13. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  14. }
  15. }
  16. if (resourceBundleName != null) {
  17. this.resourceBundle = loadResourceBundle(resourceBundleName);
  18. this.resourceBundleName = resourceBundleName;
  19. }
  20. }

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

  1. /**
  2. * Initializes this logger's resource bundle.
  3. *
  4. * @throws IllegalArgumentException if this logger's resource bundle already
  5. * exists and is different from the resource bundle specified.
  6. */
  7. private synchronized void initResourceBundle(String resourceBundleName) {
  8. String current = this.resourceBundleName;
  9. if (current != null) {
  10. if (current.equals(resourceBundleName)) {
  11. return;
  12. } else {
  13. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  14. }
  15. }
  16. if (resourceBundleName != null) {
  17. this.resourceBundle = loadResourceBundle(resourceBundleName);
  18. this.resourceBundleName = resourceBundleName;
  19. }
  20. }

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

  1. /**
  2. * Initializes this logger's resource bundle.
  3. *
  4. * @throws IllegalArgumentException if this logger's resource bundle already
  5. * exists and is different from the resource bundle specified.
  6. */
  7. private synchronized void initResourceBundle(String resourceBundleName) {
  8. String current = this.resourceBundleName;
  9. if (current != null) {
  10. if (current.equals(resourceBundleName)) {
  11. return;
  12. } else {
  13. throw new IllegalArgumentException("Resource bundle name '" + resourceBundleName + "' is inconsistent with the existing '" + current + "'");
  14. }
  15. }
  16. if (resourceBundleName != null) {
  17. this.resourceBundle = loadResourceBundle(resourceBundleName);
  18. this.resourceBundleName = resourceBundleName;
  19. }
  20. }

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

  1. public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. if (bundleName != null) {
  5. try {
  6. record.setResourceBundle(loadResourceBundle(bundleName));
  7. } catch (MissingResourceException e) {
  8. // ignore
  9. }
  10. record.setResourceBundleName(bundleName);
  11. }
  12. record.setLoggerName(this.name);
  13. record.setSourceClassName(sourceClass);
  14. record.setSourceMethodName(sourceMethod);
  15. log(record);
  16. }

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

  1. private void readObject(ObjectInputStream in) throws IOException,
  2. ClassNotFoundException {
  3. in.defaultReadObject();
  4. byte major = in.readByte();
  5. byte minor = in.readByte();
  6. // only check MAJOR version
  7. if (major != MAJOR) {
  8. throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
  9. }
  10. int length = in.readInt();
  11. if (length >= 0) {
  12. parameters = new Object[length];
  13. for (int i = 0; i < parameters.length; i++) {
  14. parameters[i] = in.readObject();
  15. }
  16. }
  17. if (resourceBundleName != null) {
  18. try {
  19. resourceBundle = Logger.loadResourceBundle(resourceBundleName);
  20. } catch (MissingResourceException e) {
  21. // Cannot find the specified resource bundle
  22. resourceBundle = null;
  23. }
  24. }
  25. }
  26. }

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

  1. public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Throwable thrown) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. if (bundleName != null) {
  5. try {
  6. record.setResourceBundle(loadResourceBundle(bundleName));
  7. } catch (MissingResourceException e) {
  8. // ignore
  9. }
  10. record.setResourceBundleName(bundleName);
  11. }
  12. record.setLoggerName(this.name);
  13. record.setSourceClassName(sourceClass);
  14. record.setSourceMethodName(sourceMethod);
  15. record.setThrown(thrown);
  16. log(record);
  17. }

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

  1. private void readObject(ObjectInputStream in) throws IOException,
  2. ClassNotFoundException {
  3. in.defaultReadObject();
  4. byte major = in.readByte();
  5. byte minor = in.readByte();
  6. // only check MAJOR version
  7. if (major != MAJOR) {
  8. throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
  9. }
  10. int length = in.readInt();
  11. if (length >= 0) {
  12. parameters = new Object[length];
  13. for (int i = 0; i < parameters.length; i++) {
  14. parameters[i] = in.readObject();
  15. }
  16. }
  17. if (resourceBundleName != null) {
  18. try {
  19. resourceBundle = Logger.loadResourceBundle(resourceBundleName);
  20. } catch (MissingResourceException e) {
  21. // Cannot find the specified resource bundle
  22. resourceBundle = null;
  23. }
  24. }
  25. }
  26. }

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

  1. private void readObject(ObjectInputStream in) throws IOException,
  2. ClassNotFoundException {
  3. in.defaultReadObject();
  4. byte major = in.readByte();
  5. byte minor = in.readByte();
  6. // only check MAJOR version
  7. if (major != MAJOR) {
  8. throw new IOException("Different version " + Byte.valueOf(major) + "." + Byte.valueOf(minor));
  9. }
  10. int length = in.readInt();
  11. if (length >= 0) {
  12. parameters = new Object[length];
  13. for (int i = 0; i < parameters.length; i++) {
  14. parameters[i] = in.readObject();
  15. }
  16. }
  17. if (resourceBundleName != null) {
  18. try {
  19. resourceBundle = Logger.loadResourceBundle(resourceBundleName);
  20. } catch (MissingResourceException e) {
  21. // Cannot find the specified resource bundle
  22. resourceBundle = null;
  23. }
  24. }
  25. }
  26. }

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

  1. public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object[] params) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. if (bundleName != null) {
  5. try {
  6. record.setResourceBundle(loadResourceBundle(bundleName));
  7. } catch (MissingResourceException e) {
  8. // ignore
  9. }
  10. record.setResourceBundleName(bundleName);
  11. }
  12. record.setLoggerName(this.name);
  13. record.setSourceClassName(sourceClass);
  14. record.setSourceMethodName(sourceMethod);
  15. record.setParameters(params);
  16. log(record);
  17. }

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

  1. public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object param) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. if (bundleName != null) {
  5. try {
  6. record.setResourceBundle(loadResourceBundle(bundleName));
  7. } catch (MissingResourceException e) {
  8. // ignore
  9. }
  10. record.setResourceBundleName(bundleName);
  11. }
  12. record.setLoggerName(this.name);
  13. record.setSourceClassName(sourceClass);
  14. record.setSourceMethodName(sourceMethod);
  15. record.setParameters(new Object[] { param });
  16. log(record);
  17. }

相关文章