本文整理汇总了Java中org.codehaus.plexus.util.cli.StreamConsumer类的典型用法代码示例。如果您正苦于以下问题:Java StreamConsumer类的具体用法?Java StreamConsumer怎么用?Java StreamConsumer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StreamConsumer类属于org.codehaus.plexus.util.cli包,在下文中一共展示了StreamConsumer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCppCheckRunner
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
private CppCheckRunner createCppCheckRunner( VCProject vcProject, StreamConsumer streamConsumer )
throws MojoExecutionException
{
CppCheckRunner cppCheckRunner = new CppCheckRunner( cppCheck.getCppCheckPath(), streamConsumer, getLog() );
cppCheckRunner.setWorkingDirectory( vcProject.getBaseDirectory() );
cppCheckRunner.setStandardInputString( getSourcesForStdin( vcProject ) );
cppCheckRunner.setCppCheckType( cppCheck.getCppCheckType() );
cppCheckRunner.setIncludeDirectories( getRelativeIncludeDirectories( vcProject ) );
cppCheckRunner.setPreprocessorDefs( vcProject.getPreprocessorDefs() );
return cppCheckRunner;
}
示例2: createEnvs
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
protected Map createEnvs( String commonToolEnvKey, String platform )
throws NativeBuildException
{
File tmpEnvExecFile = null;
try
{
File vsCommonToolDir = this.getCommonToolDirectory( commonToolEnvKey );
File vsInstallDir = this.getVisualStudioInstallDirectory( vsCommonToolDir );
if ( !vsInstallDir.isDirectory() )
{
throw new NativeBuildException( vsInstallDir.getPath() + " is not a directory." );
}
tmpEnvExecFile = this.createEnvWrapperFile( vsInstallDir, platform );
Commandline cl = new Commandline();
cl.setExecutable( tmpEnvExecFile.getAbsolutePath() );
EnvStreamConsumer stdout = new EnvStreamConsumer();
StreamConsumer stderr = new DefaultConsumer();
CommandLineUtils.executeCommandLine( cl, stdout, stderr );
return stdout.getParsedEnv();
}
catch ( Exception e )
{
throw new NativeBuildException( "Unable to retrieve env", e );
}
finally
{
if ( tmpEnvExecFile != null )
{
tmpEnvExecFile.delete();
}
}
}
示例3: setOut
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
public JavaCommand setOut(StreamConsumer out)
{
this.out = out;
return this;
}
示例4: setErr
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
public JavaCommand setErr(StreamConsumer err)
{
this.err = err;
return this;
}
示例5: executeReport
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
/**
* @param unusedLocale the wanted locale (actually unused).
* @throws MavenReportException if any
*/
protected void executeReport( Locale unusedLocale )
throws MavenReportException
{
File config = buildConfigurationFile();
Commandline cli = new Commandline();
cli.setWorkingDirectory( getBasedir().getAbsolutePath() );
cli.setExecutable( getExecutablePath() );
cli.createArgument().setValue( config.getAbsolutePath() );
Writer stringWriter = new StringWriter();
StreamConsumer out = new WriterStreamConsumer( stringWriter );
StreamConsumer err = new WriterStreamConsumer( stringWriter );
try
{
int returnCode = CommandLineUtils.executeCommandLine( cli, out, err );
if ( !isQuiet() )
{
// Get all output from doxygen and put it to the log out of Maven.
String[] lines = stringWriter.toString().split( "\n" );
for ( int i = 0; i < lines.length; i++ )
{
lines[i] = lines[i].replaceAll( "\n|\r", "" );
getLog().info( "doxygen: " + lines[i] );
}
}
if ( returnCode != 0 )
{
throw new MavenReportException( "Failed to generate Doxygen documentation." );
}
}
catch ( CommandLineException ex )
{
throw new MavenReportException( "Error while executing Doxygen.", ex );
}
}
示例6: CommandLineRunner
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
/**
* Create a new command-line process runner.
* @param processName the name of the process being run (for log messages)
* @param outputConsumer a consumer for the process' standard output
* @param errorConsumer a consumer for the process' standard error
* @see uk.org.raje.maven.plugin.msbuild.streamconsumers.StdoutStreamToLog
* @see uk.org.raje.maven.plugin.msbuild.streamconsumers.StderrStreamToLog
*/
public CommandLineRunner( String processName, StreamConsumer outputConsumer, StreamConsumer errorConsumer )
{
this.processName = processName;
this.outputConsumer = outputConsumer;
this.errorConsumer = errorConsumer;
}
示例7: setSystemOut
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
/**
* Sets the stream consumer used to handle messages from
* <code>System.out</code>.
*
* @param consumer
* The stream consumer, may be <code>null</code> to discard the output.
*/
public void setSystemOut (final StreamConsumer consumer)
{
this.systemOut = consumer;
}
示例8: setSystemErr
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
/**
* Sets the stream consumer used to handle messages from
* <code>System.err</code>.
*
* @param consumer
* The stream consumer, may be <code>null</code> to discard the output.
*/
public void setSystemErr (final StreamConsumer consumer)
{
this.systemErr = consumer;
}
示例9: CppCheckRunner
import org.codehaus.plexus.util.cli.StreamConsumer; //导入依赖的package包/类
/**
* Construct the CppCheckRunner
* @param cppCheckPath the path to CppCheck.exe
* @param reportConsumer a StreamConsumer to write the report to
* @param log the Maven Log to use
*/
public CppCheckRunner( File cppCheckPath, StreamConsumer reportConsumer, Log log )
{
super( CppCheckConfiguration.TOOL_NAME, new StdoutStreamToLog( log ), reportConsumer );
this.cppCheckPath = cppCheckPath;
}