org.apache.struts2.jasper.xmlparser

## Class XMLStringBuffer

- java.lang.Object
- - org.apache.struts2.jasper.xmlparser.XMLString
  - - org.apache.struts2.jasper.xmlparser.XMLStringBuffer

-     public class XMLStringBuffer
      extends XMLString

  XMLString is a structure used to pass character arrays. However, XMLStringBuffer is a buffer in which characters can be appended and extends XMLString so that it can be passed to methods expecting an XMLString object. This is a safe operation because it is assumed that any callee will not modify the contents of the XMLString structure.

  The contents of the string are managed by the string buffer. As characters are appended, the string buffer will grow as needed.

  Note: Never set the `ch`, `offset`, and `length` fields directly. These fields are managed by the string buffer. In order to reset the buffer, call `clear()`.

  Version:
    $Id: XMLStringBuffer.java 467222 2006-10-24 03:17:11Z markt $
  Author:
    Andy Clark, IBM, Eric Ye, IBM

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_SIZE` Default buffer size (32).

    - ### Fields inherited from class org.apache.struts2.jasper.xmlparser.XMLString

      `ch, length, offset`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLStringBuffer()`
    `XMLStringBuffer(char c)` Constructs a string buffer from a char.
    `XMLStringBuffer(char[] ch, int offset, int length)` Constructs a string buffer from the specified character array.
    `XMLStringBuffer(int size)`
    `XMLStringBuffer(String s)` Constructs a string buffer from a String.
    `XMLStringBuffer(XMLString s)` Constructs a string buffer from the specified XMLString.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(char c)` append
    `void` | `append(char[] ch, int offset, int length)` append
    `void` | `append(String s)` append
    `void` | `append(XMLString s)` append
    `void` | `clear()` Clears the string buffer.

    - ### Methods inherited from class org.apache.struts2.jasper.xmlparser.XMLString

      `equals, equals, setValues, setValues, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_SIZE

          public static final int DEFAULT_SIZE

      Default buffer size (32).
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### XMLStringBuffer

          public XMLStringBuffer()

    - #### XMLStringBuffer

          public XMLStringBuffer(int size)

      Parameters:
        `size` - size

    - #### XMLStringBuffer

          public XMLStringBuffer(char c)

      Constructs a string buffer from a char.
      Parameters:
        `c` - character

    - #### XMLStringBuffer

          public XMLStringBuffer(String s)

      Constructs a string buffer from a String.
      Parameters:
        `s` - string

    - #### XMLStringBuffer

          public XMLStringBuffer(char[] ch,
                                 int offset,
                                 int length)

      Constructs a string buffer from the specified character array.
      Parameters:
        `ch` - char array
        `offset` - offset
        `length` - length

    - #### XMLStringBuffer

          public XMLStringBuffer(XMLString s)

      Constructs a string buffer from the specified XMLString.
      Parameters:
        `s` - xml string

  - ### Method Detail

    - #### clear

          public void clear()

      Clears the string buffer.
      Overrides:
        `clear` in class `XMLString`

    - #### append

          public void append(char c)

      append
      Parameters:
        `c` - char

    - #### append

          public void append(String s)

      append
      Parameters:
        `s` - string

    - #### append

          public void append(char[] ch,
                             int offset,
                             int length)

      append
      Parameters:
        `ch` - char arry
        `offset` - offset
        `length` - length

    - #### append

          public void append(XMLString s)

      append
      Parameters:
        `s` - xml string

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.