• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ReaderFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.codehaus.plexus.util.ReaderFactory的典型用法代码示例。如果您正苦于以下问题:Java ReaderFactory类的具体用法?Java ReaderFactory怎么用?Java ReaderFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReaderFactory类属于org.codehaus.plexus.util包,在下文中一共展示了ReaderFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fromXml

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * Reads the {@link WebappStructure} from the specified file.
 *
 * @param file the file containing the webapp structure
 * @return the webapp structure
 * @throws IOException if an error occurred while reading the structure
 */
public WebappStructure fromXml( File file )
    throws IOException
{
    Reader reader = null;

    try
    {
        reader = ReaderFactory.newXmlReader( file );
        return (WebappStructure) XSTREAM.fromXML( reader );
    }
    finally
    {
        IOUtil.close( reader );
    }
}
 
开发者ID:zhegexiaohuozi,项目名称:maven-seimicrawler-plugin,代码行数:23,代码来源:WebappStructureSerializer.java


示例2: copyNbmResources

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
private void copyNbmResources()
    throws MojoExecutionException
{
    try
    {
        if ( StringUtils.isEmpty( encoding ) && isFilteringEnabled( nbmResources ) )
        {
            getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
                               + ", i.e. build is platform dependent!" );
        }
        MavenResourcesExecution mavenResourcesExecution =
            new MavenResourcesExecution( Arrays.asList( nbmResources ), clusterDir, project, encoding,
                                         Collections.EMPTY_LIST, Collections.EMPTY_LIST, session );
        mavenResourcesExecution.setEscapeWindowsPaths( true );
        mavenResourcesFiltering.filterResources( mavenResourcesExecution );
    }
    catch ( MavenFilteringException ex )
    {
        throw new MojoExecutionException( ex.getMessage(), ex );
    }
}
 
开发者ID:bitstrings,项目名称:nbm-maven,代码行数:22,代码来源:CreateNetBeansFileStructure.java


示例3: readFileAsString

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * Read the given file and return the content as a string.
 * 
 * @param file
 * @return
 * @throws java.io.IOException
 */
private String readFileAsString(File file) throws java.io.IOException {
    StringBuilder fileData = new StringBuilder(1000);
    BufferedReader reader = null;
    try {
        reader = new BufferedReader(ReaderFactory.newReader(file, encoding));
        char[] buf = new char[1024];
        int numRead = 0;
        while ((numRead = reader.read(buf)) != -1) {
            String readData = String.valueOf(buf, 0, numRead);
            fileData.append(readData);
            buf = new char[1024];
        }
    }
    finally {
        IOUtil.close(reader);
    }
    return fileData.toString();
}
 
开发者ID:marmotadev,项目名称:eclipse-formatter-standalone,代码行数:26,代码来源:FormatExecutor.java


示例4: parseExpressionDocumentation

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * <expressions>
 *   <expression>
 *     <syntax>project.distributionManagementArtifactRepository</syntax>
 *     <origin><![CDATA[
 *   <distributionManagement>
 *     <repository>
 *       <id>some-repo</id>
 *       <url>scp://host/path</url>
 *     </repository>
 *     <snapshotRepository>
 *       <id>some-snap-repo</id>
 *       <url>scp://host/snapshot-path</url>
 *     </snapshotRepository>
 *   </distributionManagement>
 *   ]]></origin>
 *     <usage><![CDATA[
 *   The repositories onto which artifacts should be deployed.
 *   One is for releases, the other for snapshots.
 *   ]]></usage>
 *   </expression>
 * <expressions>
 * @throws IOException
 * @throws XmlPullParserException
 */
private static Map parseExpressionDocumentation( InputStream docStream )
    throws IOException, XmlPullParserException
{
    Reader reader = new BufferedReader( ReaderFactory.newXmlReader( docStream ) );

    ParamdocXpp3Reader paramdocReader = new ParamdocXpp3Reader();

    ExpressionDocumentation documentation = paramdocReader.read( reader, true );

    List expressions = documentation.getExpressions();

    Map bySyntax = new HashMap();

    if ( expressions != null && !expressions.isEmpty() )
    {
        for ( Iterator it = expressions.iterator(); it.hasNext(); )
        {
            Expression expr = (Expression) it.next();

            bySyntax.put( expr.getSyntax(), expr );
        }
    }

    return bySyntax;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:51,代码来源:ExpressionDocumenter.java


示例5: readSettingsFile

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
private static Settings readSettingsFile( File settingsFile )
    throws IOException, XmlPullParserException
{
    Settings settings = null;

    Reader reader = null;

    try
    {
        reader = ReaderFactory.newXmlReader( settingsFile );

        SettingsXpp3Reader modelReader = new SettingsXpp3Reader();

        settings = modelReader.read( reader );
    }
    finally
    {
        IOUtil.close( reader );
    }

    return settings;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:PomConstructionWithSettingsTest.java


示例6: read

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
public Model read( InputStream input, Map<String, ?> options )
    throws IOException
{
    if ( input == null )
    {
        throw new IllegalArgumentException( "input stream missing" );
    }

    try
    {
        return read( ReaderFactory.newXmlReader( input ), isStrict( options ), getSource( options ) );
    }
    finally
    {
        IOUtil.close( input );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:DefaultModelReader.java


示例7: readFileAsString

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * Read the given file and return the content as a string.
 * 
 * @param file
 * @return
 * @throws java.io.IOException
 */
private String readFileAsString(File file) throws java.io.IOException {
	StringBuilder fileData = new StringBuilder(1000);
	BufferedReader reader = null;
	try {
		reader = new BufferedReader(ReaderFactory.newReader(file, encoding));
		char[] buf = new char[1024];
		int numRead = 0;
		while ((numRead = reader.read(buf)) != -1) {
			String readData = String.valueOf(buf, 0, numRead);
			fileData.append(readData);
			buf = new char[1024];
		}
	} finally {
		IOUtil.close(reader);
	}
	return fileData.toString();
}
 
开发者ID:ContaAzul,项目名称:maven-formatter-plugin-old,代码行数:25,代码来源:FormatterMojo.java


示例8: filter

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
protected void filter(File sourceFile, File targetFile)
         throws MojoExecutionException {
     try {

         if (StringUtils.isEmpty(encoding)) {
             getLog().warn(
                     "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
                             + ", i.e. build is platform dependent!");
         }
         targetFile.getParentFile().mkdirs();
         @SuppressWarnings("rawtypes")
List filters = mavenFileFilter.getDefaultFilterWrappers(project, null, true, session, null);
         mavenFileFilter.copyFile(sourceFile, targetFile, true, filters, encoding, true);
     } catch (MavenFilteringException e) {
         throw new MojoExecutionException(e.getMessage(), e);
     }
 }
 
开发者ID:retog,项目名称:karaf-maven-plugin,代码行数:18,代码来源:GenerateDescriptorMojo.java


示例9: ProjectStub

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * Default constructor
 */
public ProjectStub() {
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;
    try {
        model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
        setModel(model);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    setGroupId(model.getGroupId());
    setArtifactId(model.getArtifactId());
    setVersion(model.getVersion());
    setName(model.getName());
    setUrl(model.getUrl());
    setPackaging(model.getPackaging());

    Build build = new Build();
    build.setFinalName(model.getArtifactId());
    build.setDirectory(getBasedir() + "/target");
    build.setSourceDirectory(getBasedir() + "/src/main/java");
    build.setOutputDirectory(getBasedir() + "/target/classes");
    build.setTestSourceDirectory(getBasedir() + "/src/test/java");
    build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
    setBuild(build);

    List<String> compileSourceRoots = new ArrayList<String>();
    compileSourceRoots.add(getBasedir() + "/src/main/java");
    setCompileSourceRoots(compileSourceRoots);

    List<String> testCompileSourceRoots = new ArrayList<String>();
    testCompileSourceRoots.add(getBasedir() + "/src/test/java");
    setTestCompileSourceRoots(testCompileSourceRoots);
}
 
开发者ID:pmd,项目名称:build-tools,代码行数:38,代码来源:ProjectStub.java


示例10: setUp

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
@Before
@Override
public void setUp() throws Exception {
    File pluginPom = getTestFile("pom.xml");
    Xpp3Dom pluginPomDom = Xpp3DomBuilder.build(ReaderFactory.newXmlReader(pluginPom));
    artifactId = pluginPomDom.getChild("artifactId").getValue();
    groupId = resolveFromRootThenParent(pluginPomDom, "groupId");
    version = resolveFromRootThenParent(pluginPomDom, "version");
    super.setUp();
}
 
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:11,代码来源:AbstractMarathonMojoTestWithJUnit4.java


示例11: ProjectStub

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
public ProjectStub() {
  MavenXpp3Reader pomReader = new MavenXpp3Reader();
  Model model;
  try {
    model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
    setModel(model);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  setGroupId(model.getGroupId());
  setArtifactId(model.getArtifactId());
  setVersion(model.getVersion());
  setName(model.getName());
  setUrl(model.getUrl());
  setPackaging(model.getPackaging());

  List<String> compileSourceRoots = new ArrayList<>();
  compileSourceRoots.add(getBasedir() + "/src/main/java");
  setCompileSourceRoots(compileSourceRoots);

  List<String> testCompileSourceRoots = new ArrayList<>();
  testCompileSourceRoots.add(getBasedir() + "/src/test/java");
  setTestCompileSourceRoots(testCompileSourceRoots);

  setupBuild(model);
  setupDependencyArtifacts(model);
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:ProjectStub.java


示例12: TypeScriptDTOGeneratorMojoProjectStub

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/** Default constructor */
public TypeScriptDTOGeneratorMojoProjectStub() {
  MavenXpp3Reader pomReader = new MavenXpp3Reader();
  Model model;
  try {
    model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
    setModel(model);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  setGroupId(model.getGroupId());
  setArtifactId(model.getArtifactId());
  setVersion(model.getVersion());
  setName(model.getName());
  setUrl(model.getUrl());
  setPackaging(model.getPackaging());

  Build build = new Build();
  build.setFinalName(model.getArtifactId());
  build.setDirectory(getBasedir() + "/target");
  build.setSourceDirectory(getBasedir() + "/src/main/java");
  build.setOutputDirectory(getBasedir() + "/target/classes");
  build.setTestSourceDirectory(getBasedir() + "/src/test/java");
  build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
  setBuild(build);

  List compileSourceRoots = new ArrayList();
  compileSourceRoots.add(getBasedir() + "/src/main/java");
  setCompileSourceRoots(compileSourceRoots);

  List testCompileSourceRoots = new ArrayList();
  testCompileSourceRoots.add(getBasedir() + "/src/test/java");
  setTestCompileSourceRoots(testCompileSourceRoots);
}
 
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:TypeScriptDTOGeneratorMojoProjectStub.java


示例13: DynaModuleListGeneratorMojoProjectStub

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/** Default constructor */
public DynaModuleListGeneratorMojoProjectStub() {
  MavenXpp3Reader pomReader = new MavenXpp3Reader();
  Model model;
  try {
    model = pomReader.read(ReaderFactory.newXmlReader(new File(getBasedir(), "pom.xml")));
    setModel(model);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  setGroupId(model.getGroupId());
  setArtifactId(model.getArtifactId());
  setVersion(model.getVersion());
  setName(model.getName());
  setUrl(model.getUrl());
  setPackaging(model.getPackaging());
  setDependencies(model.getDependencies());

  Build build = new Build();
  build.setFinalName(model.getArtifactId());
  build.setDirectory(getBasedir() + "/target");
  build.setSourceDirectory(getBasedir() + "/src/main/java");
  build.setOutputDirectory(getBasedir() + "/target/classes");
  build.setTestSourceDirectory(getBasedir() + "/src/test/java");
  build.setTestOutputDirectory(getBasedir() + "/target/test-classes");
  setBuild(build);

  List compileSourceRoots = new ArrayList();
  compileSourceRoots.add(getBasedir() + "/src/main/java");
  setCompileSourceRoots(compileSourceRoots);

  List testCompileSourceRoots = new ArrayList();
  testCompileSourceRoots.add(getBasedir() + "/src/test/java");
  setTestCompileSourceRoots(testCompileSourceRoots);
}
 
开发者ID:eclipse,项目名称:che,代码行数:37,代码来源:DynaModuleListGeneratorMojoProjectStub.java


示例14: readXmlFile

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * Reads a file into a String.
 *
 * @param outFile The file to read.
 * @return String The content of the file.
 * @throws java.io.IOException when things go wrong.
 */
public static StringBuilder readXmlFile( File outFile )
    throws IOException
{
    try( Reader reader = ReaderFactory.newXmlReader( outFile ) )
    {
        return new StringBuilder( IOUtil.toString( reader ) );
    }
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:16,代码来源:PomHelper.java


示例15: readFileContents

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
private String readFileContents( File file )
    throws IOException
{

    BufferedReader reader = null;
    StringBuilder fileContents = new StringBuilder();

    try
    {
        reader = new BufferedReader( ReaderFactory.newXmlReader( file ) );

        String line = null;

        while ( ( line = reader.readLine() ) != null )
        {
            fileContents.append( line );
        }

        return fileContents.toString();

    }
    finally
    {
        if ( reader != null )
        {
            reader.close();
        }
    }

}
 
开发者ID:mojohaus,项目名称:webstart,代码行数:31,代码来源:VersionXmlGeneratorTest.java


示例16: findFragment

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * @param buildException not null
 * @return the fragment XML part where the buildException occurs.
 * @since 1.7
 */
private String findFragment(BuildException buildException) {
    if (buildException == null || buildException.getLocation() == null
            || buildException.getLocation().getFileName() == null) {
        return null;
    }

    File antFile = new File(buildException.getLocation().getFileName());
    if (!antFile.exists()) {
        return null;
    }

    LineNumberReader reader = null;
    try {
        reader = new LineNumberReader(ReaderFactory.newXmlReader(antFile));
        String line = "";
        while ((line = reader.readLine()) != null) {
            if (reader.getLineNumber() == buildException.getLocation().getLineNumber()) {
                return "around Ant part ..." + line.trim() + "... @ " + buildException.getLocation().getLineNumber() + ":"
                        + buildException.getLocation().getColumnNumber() + " in " + antFile.getAbsolutePath();
            }
        }
    } catch (Exception e) {
        getLog().debug(e.getMessage(), e);
        return null;
    } finally {
        IOUtil.close(reader);
    }

    return null;
}
 
开发者ID:0xC70FF3,项目名称:java-gems,代码行数:36,代码来源:DebianMojo.java


示例17: readXmlFile

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
/**
 * Reads a file into a String.
 *
 * @param outFile The file to read.
 * @return String The content of the file.
 * @throws java.io.IOException when things go wrong.
 */
public static StringBuilder readXmlFile( File outFile )
    throws IOException
{
    Reader reader = ReaderFactory.newXmlReader( outFile );

    try
    {
        return new StringBuilder( IOUtil.toString( reader ) );
    }
    finally
    {
        IOUtil.close( reader );
    }
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:22,代码来源:PomHelper.java


示例18: CreateSpdxMavenProjectStub

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
public CreateSpdxMavenProjectStub() {
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;
    try
    {
        model = pomReader.read( ReaderFactory.newXmlReader( new File( getBasedir(), "pom.xml" ) ) );
        setModel( model );
    }
    catch ( Exception e )
    {
        throw new RuntimeException( e );
    }

    setGroupId( model.getGroupId() );
    setArtifactId( model.getArtifactId() );
    setVersion( model.getVersion() );
    setName( model.getName() );
    setUrl( model.getUrl() );
    setPackaging( model.getPackaging() );

    Build build = new Build();
    build.setFinalName( model.getArtifactId() );
    build.setDirectory( getBasedir() + "/target" );
    build.setSourceDirectory( getBasedir() + "/src/main/java" );
    build.setOutputDirectory( getBasedir() + "/target/classes" );
    build.setTestSourceDirectory( getBasedir() + "/src/test/java" );
    build.setTestOutputDirectory( getBasedir() + "/target/test-classes" );
    setBuild( build );

    List<String> compileSourceRoots = new ArrayList<String>();
    compileSourceRoots.add( getBasedir() + "/src/main/java" );
    setCompileSourceRoots( compileSourceRoots );

    List<String> testCompileSourceRoots = new ArrayList<String>();
    testCompileSourceRoots.add( getBasedir() + "/src/test/java" );
    setTestCompileSourceRoots( testCompileSourceRoots );
}
 
开发者ID:spdx,项目名称:spdx-maven-plugin,代码行数:38,代码来源:CreateSpdxMavenProjectStub.java


示例19: readMojos

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
public static Collection<MojoDescriptor> readMojos(InputStream is) throws IOException, XmlPullParserException {
  Reader reader = ReaderFactory.newXmlReader(is);
  org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor;
  try {
    pluginDescriptor = new PluginDescriptorBuilder().build(reader);
  } catch (PlexusConfigurationException e) {
    Throwables.propagateIfPossible(e.getCause(), IOException.class, XmlPullParserException.class);
    throw Throwables.propagate(e);
  }
  List<MojoDescriptor> result = new ArrayList<>();
  for (org.apache.maven.plugin.descriptor.MojoDescriptor mojo : pluginDescriptor.getMojos()) {
    result.add(toMojoDescriptor(mojo));
  }
  return result;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:16,代码来源:LegacyPluginDescriptors.java


示例20: parse

import org.codehaus.plexus.util.ReaderFactory; //导入依赖的package包/类
@Override
public final void parse(final SourceCallback callback) throws ProcessingException, IOException {
    XmlStreamReader reader = ReaderFactory.newXmlReader(coverageFile);
    XMLStreamReader xml = createEventReader(reader);
    try {
        while (xml.hasNext()) {
            xml.next();
            onEvent(xml, callback);
        }
    } catch (XMLStreamException ex) {
        throw new ProcessingException(ex);
    } finally {
        close(xml);
        IOUtil.close(reader);
    }
}
 
开发者ID:trautonen,项目名称:coveralls-maven-plugin,代码行数:17,代码来源:AbstractXmlEventParser.java



注:本文中的org.codehaus.plexus.util.ReaderFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassVisitor类代码示例发布时间:2022-05-21
下一篇:
Java BoundedExponentialBackoffRetry类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap