Add a cdata section to a StringBuffer.

If the buffer is null, a new one is created.

@param buffer
StringBuffer to fill
@param cdataContent
the cdata content
@return the buffer
431287
private static StringBuffer doAppendCdataSection(StringBuffer buffer, String cdataContent)
	{
		buffer.append(SEQUENCE__CDATA__OPEN).append(cdataContent).append(SEQUENCE__CDATA__CLOSE);
		return buffer;
	}
446947
public void setBuffer(final String buffer) {
        initRandomBuffer();
        byteBufferAry = Arrays.copyOf(buffer.getBytes(), MAX_PACKETBUFFER_LENGTH);
    }
1089751
public static void addString(ByteBuffer buffer, String val)
  {
    addBytes(buffer, StringUtils.toUtf8(val));
  }
827715
@Override
    public void setContent(final InputStream content, final String contentType,
            final Collection<URI> checksums, final String originalFileName,
            final StoragePolicyDecisionPoint storagePolicyDecisionPoint)
            throws InvalidChecksumException {

        try {


            final Node dsNode = getNode();

            LOGGER.debug("Created content node at path: {}", dsNode.getPath());

            String hint = null;

            if (storagePolicyDecisionPoint != null) {
                hint = storagePolicyDecisionPoint.evaluatePolicies(this);
            }
            final ValueFactory modevf =
                    (ValueFactory) node.getSession().getValueFactory();
            final Binary binary = modevf.createBinary(content, hint);

        /*
         * This next line of code deserves explanation. If we chose for the
         * simpler line: Property dataProperty =
         * contentNode.setProperty(JCR_DATA, requestBodyStream); then the JCR
         * would not block on the stream's completion, and we would return to
         * the requester before the mutation to the repo had actually completed.
         * So instead we use createBinary(requestBodyStream), because its
         * contract specifies: "The passed InputStream is closed before this
         * method returns either normally or because of an exception." which
         * lets us block and not return until the job is done! The simpler code
         * may still be useful to us for an asynchronous method that we develop
         * later.
         */
            final Property dataProperty = dsNode.setProperty(JCR_DATA, binary);

            // Ensure provided checksums are valid
            final Collection<URI> nonNullChecksums = (null == checksums) ? new HashSet<>() : checksums;
            verifyChecksums(nonNullChecksums, dataProperty);

            final Node descNode = getDescriptionNodeOrNull();

            decorateContentNode(dsNode, descNode, nonNullChecksums);
            FedoraTypesUtils.touch(dsNode);

            if (descNode != null) {
                descNode.setProperty(HAS_MIME_TYPE, contentType);

                if (originalFileName != null) {
                    descNode.setProperty(FILENAME, originalFileName);
                }

                FedoraTypesUtils.touch(descNode);
            }

            LOGGER.debug("Created data property at path: {}", dataProperty.getPath());

        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
644258
private void writeBufferedData() throws IOException {
        if (buffer.length() > 0) {
            out.write(formatMessage(buffer.toString()).getBytes());
            out.write('\n');
            buffer = new StringBuffer();
        }
    }
1252066
public StringBuffer append(Reader source, StringBuffer buffer) throws IOException
	{
		BufferedReader _bufferedReader = new BufferedReader(source);
		char[] _buffer = new char[getBufferSize()]; // load by chunk of 4 ko
		try
		{
			for (int _countReadChars = 0; _countReadChars >= 0;)
			{
				buffer.append(_buffer, 0, _countReadChars);
				_countReadChars = _bufferedReader.read(_buffer);
			}
		}
		finally
		{
			_bufferedReader.close();
		}
		return buffer;
	}
1284701
public static DynamicByteBuffer create(byte[] buffer ) {
        DynamicByteBuffer buf = new DynamicByteBuffer( buffer.length );
        buf.buffer = buffer;
        return buf;
    }
834303
private function replaceLastChild_cdata(ViewElementCData $cdata)
    {
        $n = count($this->children);
        if ( ($n > 1) && ($this->children[$n - 2] instanceof ViewElementCData) ) {
            // Group the last-but-one cdata with this new cdata
            $this->children[$n - 2]->outputBuffer .= $cdata->outputBuffer;
            // and chop the final element off the children array.
            array_pop($this->children);
        } else {
            $cdata->parent        = $this;
            $this->children[$n - 1] = $cdata;
        }
    }
1022413
private function element($indent, $line, $cdata)
	{
		if ($this->content === null || (empty($this->content) && !static::HTML_MODE)) {
			return $this->standaloneTag();
		}
		else {
			$content = $this->prepareContent($this->content, $indent, $line);
			if ($cdata) {
				$content = self::CDATA_START . $content . self::CDATA_STOP;
			}
			return $this->openingTag() . $content . $this->closingTag();
		}
	}
484025
public void startCDATA() throws org.xml.sax.SAXException
  {
    m_inCData = true;
    append(m_doc.createCDATASection(""));
  }
467952
public JQMContent createContent() {
        JQMContent content = new JQMContent();
        Element elt = getElement();
        add(content, elt);
        return content;
    }
974791
public function createContent(
        ?ContentCreateData $data = null,
        ?string $name = null
    ): FormInterface {
        $data = $data ?? new ContentCreateData();
        $name = $name ?: StringUtil::fqcnToBlockPrefix(ContentCreateType::class);

        return $this->formFactory->createNamed($name, ContentCreateType::class, $data);
    }
172277
def _from_cdata(cls, cdata: Any, order: str = "C") -> "Console":
        
        if isinstance(cdata, cls):
            return cdata
        self = object.__new__(cls)  # type: Console
        self.console_c = cdata
        self._init_setup_console_data(order)
        return self
130364
public static Content content(String somePlainText) {
		Content c = null;
		try {
			c = new Content("text/plain; charset=UTF-8", somePlainText.getBytes("UTF-8"));
		} catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */
		}
		return c;
	}
1008801
public void writeCharData(String text, boolean isCDATASection) throws KNXMLException
	{
		try {
			if (isCDATASection) {
				w.write("<![CDATA[");
				w.write(text);
				w.write("]]>");
			}
			else
				w.write(References.replace(text, true));
		}
		catch (final IOException e) {
			throw new KNXMLException(e.getMessage());
		}
	}
1254300
private void addCdataSectionElement(String URI_and_localName, Vector v)
    {

        StringTokenizer tokenizer =
            new StringTokenizer(URI_and_localName, "{}", false);
        String s1 = tokenizer.nextToken();
        String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;

        if (null == s2)
        {
            // add null URI and the local name
            v.addElement(null);
            v.addElement(s1);
        }
        else
        {
            // add URI, then local name
            v.addElement(s1);
            v.addElement(s2);
        }
    }
991119
@Override
    public String validate(DTDValidatorBase v, char[] cbuf, int start, int end, boolean normalize)
        throws XMLValidationException
    {
        // Nothing to do for pure CDATA attributes...
        return null;
    }