View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.soap.axis;
8   
9   import java.io.IOException;
10  import java.io.StringWriter;
11  import java.io.Writer;
12  import java.util.HashMap;
13  import java.util.Map;
14  
15  /**
16   * <code>AxisStringWriter</code> wraps a java.io.StringWriter and allows meta information to be 
17   * associated with it.
18   */
19  public class AxisStringWriter
20  {
21      private final StringWriter writer;
22      private final Map<String, Object> properties;
23  
24      public AxisStringWriter()
25      {
26          writer = new StringWriter(4096);
27          properties = new HashMap<String, Object>();
28      }
29  
30      public void write(String string)
31      {
32          writer.write(string);
33      }
34  
35      public void write(String string, int offset, int len)
36      {
37          writer.write(string, offset, len);
38      }
39  
40      public Writer getWriter()
41      {
42          return writer;
43      }
44  
45      public void flush()
46      {
47          writer.flush();
48      }
49  
50      public void close() throws IOException
51      {
52          writer.close();
53      }
54  
55      public void setProperty(String key, Object value)
56      {
57          properties.put(key, value);
58      }
59      
60      public Map<String, Object> getProperties()
61      {
62          return properties;
63      }
64  }