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


Java IReadableResource.getInputStream方法代码示例

本文整理汇总了Java中com.helger.commons.io.resource.IReadableResource.getInputStream方法的典型用法代码示例。如果您正苦于以下问题:Java IReadableResource.getInputStream方法的具体用法?Java IReadableResource.getInputStream怎么用?Java IReadableResource.getInputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.helger.commons.io.resource.IReadableResource的用法示例。


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

示例1: CryptoProperties

import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public CryptoProperties (@Nonnull final IReadableResource aRes)
{
  ValueEnforcer.notNull (aRes, "Resource");
  if (aRes.exists ())
    try
    {
      m_aProps = new NonBlockingProperties ();
      try (final InputStream aIS = aRes.getInputStream ())
      {
        m_aProps.load (aIS);
      }
    }
    catch (final Throwable t)
    {
      throw new InitializationException ("Failed to init CryptoProperties from resource " + aRes + "!", t);
    }
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:18,代码来源:CryptoProperties.java

示例2: _readWordList

import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
private static ICommonsList <String> _readWordList (final IReadableResource aRes,
                                                    final Charset aCharset) throws IOException
{
  final ICommonsList <String> ret = new CommonsArrayList<> ();
  final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader (new InputStreamReader (aRes.getInputStream (),
                                                                                              aCharset));
  String sLine;
  int nIdx = 0;
  while ((sLine = aBR.readLine ()) != null)
  {
    nIdx++;
    if ((nIdx % 3) == 0)
    {
      ret.add (sLine);
      if (ret.size () >= 100)
        break;
    }
  }
  StreamHelper.close (aBR);
  return ret;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:22,代码来源:BenchmarkLevenshteinDistance.java

示例3: build

import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
@Nonnull
public ConfigFile build ()
{
  if (m_aPaths.isEmpty ())
    throw new IllegalStateException ("No config file path was provided!");

  IReadableResource aRes = null;
  ISettings aSettings = null;
  for (final String sConfigPath : m_aPaths)
  {
    // Support reading?
    if (m_aResProvider.supportsReading (sConfigPath))
    {
      // Convert to resource
      aRes = m_aResProvider.getReadableResource (sConfigPath);
      if (aRes != null)
      {
        // Open stream
        final InputStream aIS = aRes.getInputStream ();
        if (aIS != null)
        {
          // Read settings
          aSettings = m_aSPP.readSettings (aIS);
          if (aSettings != null)
            break;
        }
      }
    }
  }

  if (aSettings == null)
    s_aLogger.warn ("Failed to resolve config file paths: " + m_aPaths);

  return new ConfigFile (aSettings != null ? aRes : null, aSettings);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:36,代码来源:ConfigFileBuilder.java

示例4: loadProperties

import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
@Nullable
public static NonBlockingProperties loadProperties (@Nonnull final IReadableResource aRes)
{
  ValueEnforcer.notNull (aRes, "Resource");

  final InputStream aIS = aRes.getInputStream ();
  if (aIS == null)
    return null;
  return loadProperties (aIS);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:11,代码来源:PropertiesHelper.java

示例5: _readWordList

import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
private static ICommonsList <String> _readWordList (final IReadableResource aRes,
                                                    final Charset aCharset) throws IOException
{
  final ICommonsList <String> ret = new CommonsArrayList <> ();
  final BufferedReader aBR = new BufferedReader (new InputStreamReader (aRes.getInputStream (), aCharset));
  String sLine;
  while ((sLine = aBR.readLine ()) != null)
  {
    ret.add (sLine);
    if (ret.size () > 999)
      break;
  }
  StreamHelper.close (aBR);
  return ret;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:16,代码来源:BenchmarkTrie.java

示例6: CachingTransformStreamSource

import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public CachingTransformStreamSource (@Nonnull final IReadableResource aResource)
{
  this (aResource.getInputStream (), aResource.getResourceID ());
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:5,代码来源:CachingTransformStreamSource.java

示例7: CachingSAXInputSource

import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public CachingSAXInputSource (@Nonnull final IReadableResource aRes)
{
  this (aRes.getInputStream (), aRes.getResourceID ());
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:5,代码来源:CachingSAXInputSource.java


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