org.jtheque.utils.io
Class SimpleApplicationConsumer

java.lang.Object
  extended by org.jtheque.utils.io.SimpleApplicationConsumer

public final class SimpleApplicationConsumer
extends Object

This class enable to launch an application and to redirect resultStream and err flows to a StringBuilder.

Author:
adiGuba, Baptiste Wicht

Constructor Summary
SimpleApplicationConsumer(String... args)
          Construct a new SimpleApplicationConsumer to launch a simple application with some arguments.
 
Method Summary
 void consume()
          Consume all the streams of the process.
 String getResult()
          Return the result of the consumed process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleApplicationConsumer

public SimpleApplicationConsumer(String... args)
Construct a new SimpleApplicationConsumer to launch a simple application with some arguments.

Parameters:
args - The application followed by the arguments to pass to the application.
Method Detail

consume

public void consume()
             throws IOException
Consume all the streams of the process. All the streams are redirected to a simple StringBuilder.

Throws:
IOException - I/O error

getResult

public String getResult()
Return the result of the consumed process.

Returns:
The String result of the consumed process.


Copyright © 2010 JTheque. All Rights Reserved.