org.camunda.bpm.model.xml.impl.util
Class IoUtil

java.lang.Object
  extended by org.camunda.bpm.model.xml.impl.util.IoUtil

public final class IoUtil
extends Object

Author:
Daniel Meyer, Sebastian Menski

Constructor Summary
IoUtil()
           
 
Method Summary
static void closeSilently(Closeable closeable)
           
static InputStream convertOutputStreamToInputStream(OutputStream outputStream)
          Converts a OutputStream to an InputStream by coping the data directly.
static String convertXmlDocumentToString(DomDocument document)
          Converts a DomDocument to its String representation
static String getStringFromInputStream(InputStream inputStream)
          Convert an InputStream to a String
static void transformDocumentToXml(DomDocument document, StreamResult result)
          Transforms a DomDocument to XML output.
static void writeDocumentToOutputStream(DomDocument document, OutputStream outputStream)
          Writes a DomDocument to an OutputStream by transforming the DOM to XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IoUtil

public IoUtil()
Method Detail

closeSilently

public static void closeSilently(Closeable closeable)

getStringFromInputStream

public static String getStringFromInputStream(InputStream inputStream)
                                       throws IOException
Convert an InputStream to a String

Parameters:
inputStream - the InputStream to convert
Returns:
the resulting String
Throws:
IOException

convertOutputStreamToInputStream

public static InputStream convertOutputStreamToInputStream(OutputStream outputStream)
Converts a OutputStream to an InputStream by coping the data directly. WARNING: Do not use for large data (>100MB). Only for testing purpose.

Parameters:
outputStream - the OutputStream to convert
Returns:
the resulting InputStream

convertXmlDocumentToString

public static String convertXmlDocumentToString(DomDocument document)
Converts a DomDocument to its String representation

Parameters:
document - the XML document to convert

writeDocumentToOutputStream

public static void writeDocumentToOutputStream(DomDocument document,
                                               OutputStream outputStream)
Writes a DomDocument to an OutputStream by transforming the DOM to XML.

Parameters:
document - the DOM document to write
outputStream - the OutputStream to write to

transformDocumentToXml

public static void transformDocumentToXml(DomDocument document,
                                          StreamResult result)
Transforms a DomDocument to XML output.

Parameters:
document - the DOM document to transform
result - the StreamResult to write to


Copyright © 2015 camunda services GmbH. All rights reserved.