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

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

public class RootElementWrapper
extends Object

Collection of root element wrapping/unwrapping utility methods.

Author:
Jakub Podlesak

Method Summary
static InputStream unwrapInput(InputStream inputStream)
          Un-wrap input by discarding the wrapping root element.
static OutputStream unwrapOutput(OutputStream outputStream)
          Un-wrap output by discarding the wrapping root element.
static InputStream wrapInput(InputStream inputStream, String rootName)
          Wrap input into a root element with a given name.
static OutputStream wrapOutput(OutputStream outputStream, 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 InputStream wrapInput(InputStream inputStream,
                                    String rootName)
                             throws UnsupportedEncodingException
Wrap input into a root element with a given name.

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

unwrapInput

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

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

unwrapOutput

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

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

wrapOutput

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

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


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