当前位置: 首页>>代码示例>>Java>>正文


Java SnappyError类代码示例

本文整理汇总了Java中org.xerial.snappy.SnappyError的典型用法代码示例。如果您正苦于以下问题:Java SnappyError类的具体用法?Java SnappyError怎么用?Java SnappyError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SnappyError类属于org.xerial.snappy包,在下文中一共展示了SnappyError类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNativeLibraryVersion

import org.xerial.snappy.SnappyError; //导入依赖的package包/类
/**
 * Returns the Snappy native library version string without loading the native library.
 * @return Snappy native library version string
 */
public static String getNativeLibraryVersion() {
  URL versionFile = SnappyError.class.getResource("/org/xerial/snappy/VERSION");
  String version = UNKNOWN_VERSION;
  try {
    if (versionFile != null) {
      Properties versionData = new Properties();
      versionData.load(versionFile.openStream());
      version = versionData.getProperty("version", version);
      if (version.equals(UNKNOWN_VERSION)) {
        version = versionData.getProperty("VERSION", version);
      }
      version = version.trim().replaceAll("[^0-9\\.]", "");
    }
  } catch (IOException e) {
  }
  return version;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:22,代码来源:SnappyUtils.java

示例2: SnappyCompressor

import org.xerial.snappy.SnappyError; //导入依赖的package包/类
/**
 * Create a new instance of the SnappyCompressor.
 * 
 * @throws IllegaltStateException when the Snappy native library is unavailable
 */
@SuppressFBWarnings(value="DMI_RANDOM_USED_ONLY_ONCE", justification="The native library is only used once so we only need to generate one random number")
public SnappyCompressor() {
  synchronized (defaultInstance) {
    if (!nativeLibraryLoaded) {
      try {
        SnappyUtils.setSnappySystemProperties(SnappyUtils.getOrCreateLogWriter());
        Snappy.getNativeLibraryVersion();
      } catch (SnappyError se) {
        throw new IllegalStateException(LocalizedStrings.SnappyCompressor_UNABLE_TO_LOAD_NATIVE_SNAPPY_LIBRARY.toLocalizedString(), se);
      }
      nativeLibraryLoaded = true;
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:20,代码来源:SnappyCompressor.java


注:本文中的org.xerial.snappy.SnappyError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。