Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2006-2014 smartics, Kronseder & Reiner GmbH
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.redhat.rcm.maven.plugin.buildmetadata.util;
 
 
 
Utilities for Mojos working with IO.

Author(s):
Robert Reiner
Version:
$Revision:591 $
 
 public final class MojoIoUtils
 {
   // ********************************* Fields *********************************
 
   // --- constants ------------------------------------------------------------
 
   // --- members --------------------------------------------------------------
 
   // ****************************** Initializer *******************************
 
   // ****************************** Constructors ******************************
 
   private MojoIoUtils()
   {
   }
 
   // ****************************** Inner Classes *****************************
 
   // ********************************* Methods ********************************
 
   // --- init -----------------------------------------------------------------
 
   // --- get&set --------------------------------------------------------------
 
   // --- business -------------------------------------------------------------
 
   // --- object basics --------------------------------------------------------
 
  
Writes the DOM document to the given stream in pretty print format.

Parameters:
document the document to write.
out the stream to write to.
Throws:
javax.xml.transform.TransformerException on any problem writing to the stream.
 
   public static void serialize(final Document documentfinal OutputStream out)
     throws TransformerException
   {
     serialize(documentouttrue);
   }

  
Writes the DOM document to the given stream.

Parameters:
document the document to write.
out the stream to write to.
prettyPrint the flag controls indentation. If set to true, indent is set to 2.
Throws:
javax.xml.transform.TransformerException on any problem writing to the stream.
 
   public static void serialize(final Document documentfinal OutputStream out,
       final boolean prettyPrintthrows TransformerException
   {
     final TransformerFactory factory = TransformerFactory.newInstance();
     final Transformer serializer = factory.newTransformer();
     if (prettyPrint)
     {
       serializer.setOutputProperty(."yes");
       serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
           "2");
     }
 
     serializer.transform(new DOMSource(document), new StreamResult(out));
   }
 
  // --- object basics --------------------------------------------------------
New to GrepCode? Check out our FAQ X