KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > marshall > http > metadata > HTTPUnMarshallerMock


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.remoting.marshall.http.metadata;
8
9 import org.jboss.remoting.marshal.http.HTTPUnMarshaller;
10
11 import java.io.IOException JavaDoc;
12 import java.io.InputStream JavaDoc;
13 import java.util.HashMap JavaDoc;
14 import java.util.Map JavaDoc;
15
16 /**
17  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
18  */

19 public class HTTPUnMarshallerMock extends HTTPUnMarshaller
20 {
21    private Map JavaDoc metadata = new HashMap JavaDoc();
22
23    /**
24     * Will try to unmarshall data from inputstream. Will try to convert to either an object
25     * or a string. If there is no data to read, will return null.
26     *
27     * @param inputStream
28     * @return
29     * @throws java.io.IOException
30     * @throws ClassNotFoundException
31     */

32    public Object JavaDoc read(InputStream JavaDoc inputStream, Map JavaDoc metadata) throws IOException JavaDoc, ClassNotFoundException JavaDoc
33    {
34       Object JavaDoc ret = super.read(inputStream, metadata);
35       this.metadata.putAll(metadata);
36       return ret;
37    }
38
39    public Map JavaDoc getMetadata()
40    {
41       return metadata;
42    }
43 }
Popular Tags