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


Java StreamHelper.createReader方法代码示例

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


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

示例1: readFromStream

import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
@Nullable
public static STXPath readFromStream (@Nonnull final IHasInputStream aISP, @Nonnull final Charset aCharset)
{
  ValueEnforcer.notNull (aISP, "InputStreamProvider");
  ValueEnforcer.notNull (aCharset, "Charset");

  final InputStream aIS = aISP.getInputStream ();
  final Reader aReader = StreamHelper.createReader (aIS, aCharset);
  try
  {
    final STXCharStream aCharStream = new STXCharStream (aReader);

    final STXNode aNode = _readSTXPath (aCharStream);

    // Failed to interpret content as CSS?
    if (aNode == null)
      return null;

    // Convert the AST to a domain object
    final STXPath ret = STXNodeToDomainObject.convertToDomainObject (aNode);
    return ret;
  }
  finally
  {
    StreamHelper.close (aReader);
  }
}
 
开发者ID:phax,项目名称:ph-stx,代码行数:28,代码来源:STXReader.java

示例2: getReaderByBOM

import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
@Nonnull
public static InputStreamReader getReaderByBOM (@Nonnull final InputStream aIS,
                                                @Nonnull final Charset aFallbackCharset)
{
  ValueEnforcer.notNull (aIS, "InputStream");
  ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");

  // Determine BOM/Charset
  final InputStreamAndCharset aISAndBOM = getInputStreamAndCharsetFromBOM (aIS);

  // Create the reader with the current position of the InputStream and the
  // correct charset
  final Charset aEffectiveCharset = aISAndBOM.getCharset (aFallbackCharset);
  return StreamHelper.createReader (aISAndBOM.getInputStream (), aEffectiveCharset);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:16,代码来源:CharsetHelper.java

示例3: getReader

import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
@Nullable
public static Reader getReader (@Nonnull final Path aFile, @Nonnull final Charset aCharset)
{
  ValueEnforcer.notNull (aFile, "Path");
  ValueEnforcer.notNull (aCharset, "Charset");

  return StreamHelper.createReader (getInputStream (aFile), aCharset);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:PathHelper.java

示例4: getReader

import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
@Nullable
public static InputStreamReader getReader (@Nonnull final File aFile, @Nonnull final Charset aCharset)
{
  ValueEnforcer.notNull (aFile, "File");
  ValueEnforcer.notNull (aCharset, "Charset");

  return StreamHelper.createReader (getInputStream (aFile), aCharset);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:FileHelper.java

示例5: getReader

import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
@Nullable
public Reader getReader (@Nonnull final String sName)
{
  return StreamHelper.createReader (getInputStream (sName), m_aCharset);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:6,代码来源:FileSystemCharStreamProvider.java

示例6: getReaderNoCache

import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
/**
 * Create a {@link Reader} of this resource, using the specified class loader
 * only.
 *
 * @param aClassLoader
 *        The class loader to be used. May not be <code>null</code>.
 * @param aCharset
 *        The charset to be used for the {@link Reader}. May not be
 *        <code>null</code>.
 * @return <code>null</code> if the path could not be resolved.
 */
@Nullable
public Reader getReaderNoCache (@Nonnull final ClassLoader aClassLoader, @Nonnull final Charset aCharset)
{
  return StreamHelper.createReader (getInputStreamNoCache (aClassLoader), aCharset);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:17,代码来源:ClassPathResource.java

示例7: getReader

import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
/**
 * Get an {@link Reader} based on this input stream provider using the given
 * charset.
 *
 * @param aCharset
 *        The charset to use. May not be <code>null</code>.
 * @return <code>null</code> if no input stream could be retrieved.
 */
@Nullable
default Reader getReader (@Nonnull final Charset aCharset)
{
  return StreamHelper.createReader (getInputStream (), aCharset);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:14,代码来源:IHasInputStreamAndReader.java


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