本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}