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