本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例6: CachingTransformStreamSource
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public CachingTransformStreamSource (@Nonnull final IReadableResource aResource)
{
this (aResource.getInputStream (), aResource.getResourceID ());
}
示例7: CachingSAXInputSource
import com.helger.commons.io.resource.IReadableResource; //导入方法依赖的package包/类
public CachingSAXInputSource (@Nonnull final IReadableResource aRes)
{
this (aRes.getInputStream (), aRes.getResourceID ());
}