WriterUtility.java revision 286
286N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. 286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 286N/A * This code is free software; you can redistribute it and/or modify it 286N/A * under the terms of the GNU General Public License version 2 only, as 286N/A * published by the Free Software Foundation. Oracle designates this 286N/A * particular file as subject to the "Classpath" exception as provided 286N/A * by Oracle in the LICENSE file that accompanied this code. 286N/A * This code is distributed in the hope that it will be useful, but WITHOUT 286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 286N/A * version 2 for more details (a copy is included in the LICENSE file that 286N/A * accompanied this code). 286N/A * You should have received a copy of the GNU General Public License version 286N/A * 2 along with this work; if not, write to the Free Software Foundation, 286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 286N/A * or visit www.oracle.com if you need additional information or have any 286N/A * Implements common xml writer functions. 286N/A * @author Neeraj Bajaj,K.Venugopal Sun Microsystems. 286N/A /**XXX: This feature is only used when writing element content values. 286N/A * default value is 'true' however, if the feature is set to false 286N/A * characters wont be escaped. 286N/A * This feature has no effect when writing Attribute values, character would still be escaped. 286N/A * I can't think of any reason why this would be useful when writing attribute values. 286N/A * However, this can be reconsidered if there is any usecase. 286N/A /** Creates a new instance of WriterUtility */ 286N/A //attempt to retreive default fEncoderoder 286N/A * sets the writer object 286N/A * @param writer file to write into 286N/A * writes xml content (characters and element content 286N/A * writes xml content (characters and element content 286N/A //define startWritePos to track the position from where the character array data needs to be written 286N/A //initialize this variable to start pos. indicating that no data has been written 286N/A //- write the data to the point we get this character 286N/A //escape this character 286N/A //increase the startWritePos by 1 indicating that next write should start from 286N/A //this character needs to be escaped, write the data from the last write pos 286N/A //increase the startWritePos by 1 indicating that next write should start from 286N/A //this character needs to be escaped, write the data from the last write pos 286N/A //increase the startWritePos by 1 indicating that next write should start from 286N/A //this character needs to be escaped, write the data from the last write pos 286N/A //increase the startWritePos by 1 indicating that next write should start from 286N/A //write any pending data 286N/A * writes xml content (characters and element content 286N/A * Write Attribute value to the underlying stream. 286N/A //for any exception thrown , catch and continue