private void ensureContentAvailable ( ) throws IOException { if ( nodeContentBytes . size ( ) > 0 ) { return ; } try { Transform serializeTransform = new Transform ( rootNode ) ; if ( outputProperties != null ) { serializeTransform . setOutputProperties ( outputProperties ) ; } StreamResult byteResult = new StreamResult ( nodeContentBytes ) ; serializeTransform . transformTo ( byteResult ) ; } catch ( Exception e ) { throw new IOException ( "Unable to serialize document to outputstream: " + e . toString ( ) ) ; } }
Do the actual work of serializing the node to bytes