View Javadoc
1   package org.codehaus.mojo.natives.msvc;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   import org.codehaus.plexus.util.StringUtils;
7   import org.codehaus.plexus.util.cli.StreamConsumer;
8   
9   public class EnvStreamConsumer
10      implements StreamConsumer
11  {
12  
13      public static final String START_PARSING_INDICATOR =
14          "================================This is the beginning of env parsing================================";
15  
16      private Map envs = new HashMap();
17  
18      private boolean startParsing = false;
19  
20      public void consumeLine( String line )
21      {
22  
23          if ( line.startsWith( START_PARSING_INDICATOR ) )
24          {
25              this.startParsing = true;
26              return;
27          }
28  
29          if ( this.startParsing )
30          {
31              String[] tokens = StringUtils.split( line, "=" );
32              if ( tokens.length == 2 )
33              {
34                  envs.put( tokens[0], tokens[1] );
35              }
36          }
37          else
38          {
39              System.out.println( line );
40          }
41  
42      }
43  
44      public Map getParsedEnv()
45      {
46          return this.envs;
47      }
48  
49  }