org.codehaus.plexus.util.xml.XmlStreamReader.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(64)

本文整理了Java中org.codehaus.plexus.util.xml.XmlStreamReader.<init>()方法的一些代码示例,展示了XmlStreamReader.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlStreamReader.<init>()方法的具体详情如下:
包路径:org.codehaus.plexus.util.xml.XmlStreamReader
类名称:XmlStreamReader
方法名:<init>

XmlStreamReader.<init>介绍

[英]Creates a Reader for a File.

It looks for the UTF-8 BOM first, if none sniffs the XML prolog charset, if this is also missing defaults to UTF-8.

It does a lenient charset encoding detection, check the constructor with the lenient parameter for details.
[中]为文件创建读取器。
它首先查找UTF-8 BOM,如果没有嗅探XML prolog字符集,如果也缺少,则默认为UTF-8。
它执行宽松的字符集编码检测,请使用lenient参数检查构造函数以了解详细信息。

代码示例

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * Create a new Reader with XML encoding detection rules.
 *
 * @param in not null input stream.
 * @return an XML reader instance for the input stream.
 * @throws IOException if any.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( InputStream in )
  throws IOException
{
  return new XmlStreamReader( in );
}

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * Create a new Reader with XML encoding detection rules.
 *
 * @param url not null url.
 * @return an XML reader instance for the input url.
 * @throws IOException if any.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( URL url )
  throws IOException
{
  return new XmlStreamReader( url );
}

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * Create a new Reader with XML encoding detection rules.
 *
 * @param file not null file.
 * @return an XML reader instance for the input file.
 * @throws IOException if any.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( File file )
  throws IOException
{
  return new XmlStreamReader( file );
}

代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core

/**
 * Create a new Reader with XML encoding detection rules.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( File file )
throws IOException
{
  return new XmlStreamReader( file );
}

代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core

/**
 * Create a new Reader with XML encoding detection rules.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( InputStream in )
throws IOException
{
  return new XmlStreamReader( in );
}

代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core

/**
 * Create a new Reader with XML encoding detection rules.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( URL url )
throws IOException
{
  return new XmlStreamReader( url );
}

代码示例来源:origin: org.sonatype.gshell/gshell-util

/**
 * Create a new Reader with XML encoding detection rules.
 *
 * @param file not null file.
 * @return an XML reader instance for the input file.
 * @throws IOException if any.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( File file )
throws IOException
{
  return new XmlStreamReader( file );
}

代码示例来源:origin: org.sonatype.gshell/gshell-util

/**
 * Create a new Reader with XML encoding detection rules.
 *
 * @param in not null input stream.
 * @return an XML reader instance for the input stream.
 * @throws IOException if any.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( InputStream in )
throws IOException
{
  return new XmlStreamReader( in );
}

代码示例来源:origin: org.sonatype.gshell/gshell-util

/**
 * Create a new Reader with XML encoding detection rules.
 *
 * @param url not null url.
 * @return an XML reader instance for the input url.
 * @throws IOException if any.
 * @see XmlStreamReader
 */
public static XmlStreamReader newXmlReader( URL url )
throws IOException
{
  return new XmlStreamReader( url );
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin

private static Xpp3Dom parseXmlItem(final StorageFileItem item)
  throws IOException, XmlPullParserException
{
 try (InputStream is = item.getInputStream()) {
  return Xpp3DomBuilder.build(new XmlStreamReader(is));
 }
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin

private Xpp3Dom getMirrorsDom(final StorageFileItem mirrorsItem)
  throws IOException, XmlPullParserException
{
 try (InputStream is = mirrorsItem.getInputStream()) {
  return Xpp3DomBuilder.build(new XmlStreamReader(is));
 }
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin

private static Xpp3Dom parseJarItem(final StorageFileItem item, final String jarPath)
   throws IOException, XmlPullParserException
 {
  final File file = File.createTempFile("p2file", "zip");
  try {
   try (InputStream is = item.getInputStream()) {
    FileUtils.copyInputStreamToFile(is, file);
    try (ZipFile z = new ZipFile(file)) {
     final ZipEntry ze = z.getEntry(jarPath);
     if (ze == null) {
      throw new LocalStorageException("Corrupted P2 metadata jar " + jarPath);
     }
     try (InputStream zis = z.getInputStream(ze)) {
      return Xpp3DomBuilder.build(new XmlStreamReader(zis));
     }
    }
   }
  }
  finally {
   file.delete();
  }
 }
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-yum-repository-client

private static Map<String, String> parse(final InputStream in) {
 try {
  final Map<String, String> locations = Maps.newHashMap();
  final Xpp3Dom dom = Xpp3DomBuilder.build(new XmlStreamReader(in));
  for (final Xpp3Dom data : dom.getChildren("data")) {
   final Xpp3Dom location = data.getChild("location");
   final String type = data.getAttribute("type");
   final String href = location.getAttribute("href");
   locations.put(type, href);
  }
  return locations;
 }
 catch (Exception e) {
  throw Throwables.propagate(e);
 }
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin

private static Map<String, String> parse(final InputStream in) {
 try {
  final Map<String, String> locations = Maps.newHashMap();
  final Xpp3Dom dom = Xpp3DomBuilder.build(new XmlStreamReader(in));
  for (final Xpp3Dom data : dom.getChildren("data")) {
   final Xpp3Dom location = data.getChild("location");
   final String type = data.getAttribute("type");
   final String href = location.getAttribute("href");
   locations.put(type, href);
  }
  return locations;
 }
 catch (Exception e) {
  throw Throwables.propagate(e);
 }
}

代码示例来源:origin: org.codehaus.tycho/tycho-osgi-components

FileInputStream is = new FileInputStream(platform);
try {
  XmlStreamReader reader = new XmlStreamReader(is);
  Xpp3Dom dom = Xpp3DomBuilder.build(reader);
  Xpp3Dom[] sites = dom.getChildren("site");

代码示例来源:origin: org.eclipse.tycho/tycho-core

FileInputStream is = new FileInputStream(platform);
try {
  XmlStreamReader reader = new XmlStreamReader(is);
  Xpp3Dom dom = Xpp3DomBuilder.build(reader);
  Xpp3Dom[] sites = dom.getChildren("site");

代码示例来源:origin: io.takari.maven.plugins/takari-plugin-testing

XmlStreamReader reader = new XmlStreamReader(is);

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin

Xpp3Dom dom;
try {
 dom = Xpp3DomBuilder.build(new XmlStreamReader(artifactMappingsItem.getInputStream()));

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin

dom = Xpp3DomBuilder.build(new XmlStreamReader(new File(metadataRepositoryDir, "content.xml")));

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin

dom = Xpp3DomBuilder.build(new XmlStreamReader(new File(artifactRepositoryDir, "artifacts.xml")));
storeItemFromFile(P2Constants.ARTIFACT_MAPPINGS_XML, artifactMappingsXmlFile, repository);
repository.initArtifactMappingsAndMirrors();

相关文章

微信公众号

最新文章

更多