public final class IoUtil extends Object
| Constructor and Description | 
|---|
| IoUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | closeSilently(Closeable closeable) | 
| static InputStream | convertOutputStreamToInputStream(OutputStream outputStream)Converts a  OutputStreamto anInputStreamby coping the data directly. | 
| static String | convertXmlDocumentToString(DomDocument document)Converts a  DomDocumentto its String representation | 
| static String | getStringFromInputStream(InputStream inputStream)Convert an  InputStreamto aString | 
| static void | transformDocumentToXml(DomDocument document,
                      StreamResult result)Transforms a  DomDocumentto XML output. | 
| static void | writeDocumentToOutputStream(DomDocument document,
                           OutputStream outputStream)Writes a  DomDocumentto anOutputStreamby transforming the DOM to XML. | 
public static void closeSilently(Closeable closeable)
public static String getStringFromInputStream(InputStream inputStream) throws IOException
InputStream to a StringinputStream - the InputStream to convertStringIOExceptionpublic static InputStream convertOutputStreamToInputStream(OutputStream outputStream)
OutputStream to an InputStream by coping the data directly.
 WARNING: Do not use for large data (>100MB). Only for testing purpose.outputStream - the OutputStream to convertInputStreampublic static String convertXmlDocumentToString(DomDocument document)
DomDocument to its String representationdocument - the XML document to convertpublic static void writeDocumentToOutputStream(DomDocument document, OutputStream outputStream)
DomDocument to an OutputStream by transforming the DOM to XML.document - the DOM document to writeoutputStream - the OutputStream to write topublic static void transformDocumentToXml(DomDocument document, StreamResult result)
DomDocument to XML output.document - the DOM document to transformresult - the StreamResult to write toCopyright © 2018. All rights reserved.