- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.openStream()
方法的一些代码示例,展示了YangTextSchemaSource.openStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangTextSchemaSource.openStream()
方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource
类名称:YangTextSchemaSource
方法名:openStream
暂无
代码示例来源:origin: org.opendaylight.yangtools/yang-model-util
@Override
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
justification = "https://github.com/spotbugs/spotbugs/issues/600")
protected void storeAsType(final File file, final YangTextSchemaSource cast) {
try (InputStream castStream = cast.openStream()) {
Files.copy(castStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (final IOException e) {
throw new IllegalStateException("Cannot store schema source " + cast.getIdentifier() + " to " + file,
e);
}
}
代码示例来源:origin: opendaylight/yangtools
@Override
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
justification = "https://github.com/spotbugs/spotbugs/issues/600")
protected void storeAsType(final File file, final YangTextSchemaSource cast) {
try (InputStream castStream = cast.openStream()) {
Files.copy(castStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (final IOException e) {
throw new IllegalStateException("Cannot store schema source " + cast.getIdentifier() + " to " + file,
e);
}
}
代码示例来源:origin: org.opendaylight.controller/netconf-testtool
private Map<ModuleBuilder, String> toModuleBuilders(final Map<SourceIdentifier, Map.Entry<ASTSchemaSource, YangTextSchemaSource>> sources) {
final Map<SourceIdentifier, ParserRuleContext> asts = Maps.transformValues(sources, new Function<Map.Entry<ASTSchemaSource, YangTextSchemaSource>, ParserRuleContext>() {
@Override
public ParserRuleContext apply(final Map.Entry<ASTSchemaSource, YangTextSchemaSource> input) {
return input.getKey().getAST();
}
});
final Map<String, NavigableMap<Date, URI>> namespaceContext = BuilderUtils.createYangNamespaceContext(
asts.values(), Optional.<SchemaContext>absent());
final ParseTreeWalker walker = new ParseTreeWalker();
final Map<ModuleBuilder, String> sourceToBuilder = new HashMap<>();
for (final Map.Entry<SourceIdentifier, ParserRuleContext> entry : asts.entrySet()) {
final ModuleBuilder moduleBuilder = YangParserListenerImpl.create(namespaceContext, entry.getKey().getName(),
walker, entry.getValue()).getModuleBuilder();
try(InputStreamReader stream = new InputStreamReader(sources.get(entry.getKey()).getValue().openStream(), Charsets.UTF_8)) {
sourceToBuilder.put(moduleBuilder, CharStreams.toString(stream));
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
return sourceToBuilder;
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
private static Optional<YangModuleCapability> moduleToCapability(
final Module module, final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProviderDependency) {
final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
(SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.<String>absent() :
Optional.of(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()))));
InputStream sourceStream = null;
String source;
try {
sourceStream = rootSchemaSourceProviderDependency.getSource(moduleSourceIdentifier).checkedGet().openStream();
source = CharStreams.toString(new InputStreamReader(sourceStream, StandardCharsets.UTF_8));
} catch (IOException | SchemaSourceException e) {
LOG.warn("Ignoring source for module {}. Unable to read content", moduleSourceIdentifier, e);
source = null;
}
try {
if (sourceStream != null) {
sourceStream.close();
}
} catch (IOException e) {
LOG.warn("Error closing yang source stream {}. Ignoring", moduleSourceIdentifier, e);
}
if(source !=null) {
return Optional.of(new YangModuleCapability(module, source));
} else {
LOG.warn("Missing source for module {}. This module will not be available from netconf server",
moduleSourceIdentifier);
}
return Optional.absent();
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
/**
* Create a {@link YangStatementStreamSource} for a {@link YangTextSchemaSource}.
*
* @param source YangTextSchemaSource, must not be null
* @return A new {@link YangStatementStreamSource}
* @throws IOException When we fail to read the source
* @throws YangSyntaxErrorException If the source fails basic parsing
*/
public static YangStatementStreamSource create(final YangTextSchemaSource source) throws IOException,
YangSyntaxErrorException {
final StatementContext context;
try (InputStream stream = source.openStream()) {
context = parseYangSource(source.getIdentifier(), stream);
}
return new YangStatementStreamSource(source.getIdentifier(), context, source.getSymbolicName().orElse(null));
}
本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.read()方法的一些代码示例,展示了Yan
本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.openStream()方法的一些代码示例,
本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.delegateForByteSource(
本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.getIdentifier()方法的一些代码
本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.forFile()方法的一些代码示例,展示了
本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.forResource()方法的一些代码示例
我是一名优秀的程序员,十分优秀!