0N/A/*
2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A *******************************************************************************
0N/A * (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved *
0N/A * *
0N/A * The original version of this source code and documentation is copyrighted *
0N/A * and owned by IBM, These materials are provided under terms of a License *
0N/A * Agreement between IBM and Sun. This technology is protected by multiple *
0N/A * US and International patents. This notice and attribution to IBM may not *
0N/A * to removed. *
0N/A *******************************************************************************
0N/A */
0N/A
0N/Apackage sun.text.normalizer;
0N/A
0N/A/**
0N/A * <code>ReplaceableString</code> is an adapter class that implements the
0N/A * <code>Replaceable</code> API around an ordinary <code>StringBuffer</code>.
0N/A *
0N/A * <p><em>Note:</em> This class does not support attributes and is not
0N/A * intended for general use. Most clients will need to implement
0N/A * {@link Replaceable} in their text representation class.
0N/A *
0N/A * <p>Copyright &copy; IBM Corporation 1999. All rights reserved.
0N/A *
0N/A * @see Replaceable
0N/A * @author Alan Liu
0N/A * @stable ICU 2.0
0N/A */
0N/Apublic class ReplaceableString implements Replaceable {
0N/A
0N/A private StringBuffer buf;
0N/A
0N/A /**
0N/A * Construct a new object with the given initial contents.
0N/A * @param str initial contents
0N/A * @stable ICU 2.0
0N/A */
0N/A public ReplaceableString(String str) {
0N/A buf = new StringBuffer(str);
0N/A }
0N/A
0N/A //// for StringPrep
0N/A /**
0N/A * Construct a new object using <code>buf</code> for internal
0N/A * storage. The contents of <code>buf</code> at the time of
0N/A * construction are used as the initial contents. <em>Note!
0N/A * Modifications to <code>buf</code> will modify this object, and
0N/A * vice versa.</em>
0N/A * @param buf object to be used as internal storage
0N/A * @stable ICU 2.0
0N/A */
0N/A public ReplaceableString(StringBuffer buf) {
0N/A this.buf = buf;
0N/A }
0N/A
0N/A /**
0N/A * Return the number of characters contained in this object.
0N/A * <code>Replaceable</code> API.
0N/A * @stable ICU 2.0
0N/A */
0N/A public int length() {
0N/A return buf.length();
0N/A }
0N/A
0N/A /**
0N/A * Return the character at the given position in this object.
0N/A * <code>Replaceable</code> API.
0N/A * @param offset offset into the contents, from 0 to
0N/A * <code>length()</code> - 1
0N/A * @stable ICU 2.0
0N/A */
0N/A public char charAt(int offset) {
0N/A return buf.charAt(offset);
0N/A }
0N/A
0N/A //// for StringPrep
0N/A /**
0N/A * Copies characters from this object into the destination
0N/A * character array. The first character to be copied is at index
0N/A * <code>srcStart</code>; the last character to be copied is at
0N/A * index <code>srcLimit-1</code> (thus the total number of
0N/A * characters to be copied is <code>srcLimit-srcStart</code>). The
0N/A * characters are copied into the subarray of <code>dst</code>
0N/A * starting at index <code>dstStart</code> and ending at index
0N/A * <code>dstStart + (srcLimit-srcStart) - 1</code>.
0N/A *
0N/A * @param srcStart the beginning index to copy, inclusive; <code>0
0N/A * <= start <= limit</code>.
0N/A * @param srcLimit the ending index to copy, exclusive;
0N/A * <code>start <= limit <= length()</code>.
0N/A * @param dst the destination array.
0N/A * @param dstStart the start offset in the destination array.
0N/A * @stable ICU 2.0
0N/A */
0N/A public void getChars(int srcStart, int srcLimit, char dst[], int dstStart) {
0N/A Utility.getChars(buf, srcStart, srcLimit, dst, dstStart);
0N/A }
0N/A}