KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > 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.test.remoting.marshall.http.metadata;
8
9 import java.io.IOException JavaDoc;
10 import java.io.InputStream JavaDoc;
11 import java.util.HashMap JavaDoc;
12 import java.util.Map JavaDoc;
13 import org.jboss.remoting.marshal.http.HTTPUnMarshaller;
14
15 /**
16  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
17  */

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

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