org.glassfish.jersey.media.json.internal
Class RootElementWrapper

java.lang.Object
  extended by org.glassfish.jersey.media.json.internal.RootElementWrapper

public class RootElementWrapper
extends java.lang.Object

Collection of root element wrapping/unwrapping utility methods.

Author:
Jakub Podlesak

Method Summary
static java.io.InputStream unwrapInput(java.io.InputStream inputStream)
          Un-wrap input by discarding the wrapping root element.
static java.io.OutputStream unwrapOutput(java.io.OutputStream outputStream)
          Un-wrap output by discarding the wrapping root element.
static java.io.InputStream wrapInput(java.io.InputStream inputStream, java.lang.String rootName)
          Wrap input into a root element with a given name.
static java.io.OutputStream wrapOutput(java.io.OutputStream outputStream, java.lang.String rootName)
          Wrap output into a root element with a given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrapInput

public static java.io.InputStream wrapInput(java.io.InputStream inputStream,
                                            java.lang.String rootName)
                                     throws java.io.UnsupportedEncodingException
Wrap input into a root element with a given name.

Parameters:
inputStream - input stream.
rootName - root element name.
Returns:
wrapping input stream.
Throws:
java.io.UnsupportedEncodingException - in case the input stream encoding is not supported.

unwrapInput

public static java.io.InputStream unwrapInput(java.io.InputStream inputStream)
                                       throws java.io.IOException
Un-wrap input by discarding the wrapping root element.

Parameters:
inputStream - wrapped input stream.
Returns:
un-wrapped input stream.
Throws:
java.io.IOException - in case of I/O error.

unwrapOutput

public static java.io.OutputStream unwrapOutput(java.io.OutputStream outputStream)
                                         throws java.io.IOException
Un-wrap output by discarding the wrapping root element.

Parameters:
outputStream - wrapped output stream.
Returns:
un-wrapped output stream.
Throws:
java.io.IOException - in case of I/O error.

wrapOutput

public static java.io.OutputStream wrapOutput(java.io.OutputStream outputStream,
                                              java.lang.String rootName)
                                       throws java.io.IOException
Wrap output into a root element with a given name.

Parameters:
outputStream - output stream.
rootName - root element name.
Returns:
wrapping output stream.
Throws:
java.io.IOException - in case of I/O error.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.