Adds the UTF-8 marker add the beginning of the byte array.<p>

@param content the byte array where to add the UTF-8 marker

@return the byte with the added UTF-8 marker at the beginning
776205
public static byte[] addUtf8Marker(byte[] content) {

        if ((content != null)
            && (content.length >= 3)
            && (content[0] == UTF8_MARKER[0])
            && (content[1] == UTF8_MARKER[1])
            && (content[2] == UTF8_MARKER[2])) {
            return content;
        }

        if (content == null) {
            content = new byte[0];
        }

        byte[] ret = new byte[UTF8_MARKER.length + content.length];

        System.arraycopy(UTF8_MARKER, 0, ret, 0, UTF8_MARKER.length);
        System.arraycopy(content, 0, ret, UTF8_MARKER.length, content.length);

        return ret;
    }
666618
public static InputStream toStream(String content, Charset charset) {
        byte[] bytes = content.getBytes(charset);
        return new ByteArrayInputStream(bytes);
    }
1028747
private static String decodeFormFields (final String content, final String charset) {
        if (content == null) {
            return null;
        }
        return urldecode(content, charset != null ? Charset.forName(charset) : Consts.UTF_8, true);
    }
1292075
protected String getEncoding(String content) {

        String encoding = content;
        int index = encoding.toLowerCase().indexOf("encoding=\"");
        // encoding attribute found, get the value
        if (index != -1) {
            encoding = encoding.substring(index + 10);
            index = encoding.indexOf("\"");
            if (index != -1) {
                encoding = encoding.substring(0, index);
                return encoding.toUpperCase();
            }
        }
        // no encoding attribute found
        return "";
    }
187404
private Locale getLocale(CmsXmlContent content) {

        List<Locale> locales = content.getLocales();
        if (locales.contains(Locale.ENGLISH) || locales.isEmpty()) {
            return Locale.ENGLISH;
        }
        return locales.get(0);
    }
114330
public static byte[] gzip(String content, String charset) throws UtilException {
		return gzip(StrUtil.bytes(content, charset));
	}
301395
public static String replaceHtmlEntities(String content, Map<String, Character> map) {
    
    for (Entry<String, Character> entry : escapeStrings.entrySet()) {
      
      if (content.indexOf(entry.getKey()) != -1) {
        content = content.replace(entry.getKey(), String.valueOf(entry.getValue()));
      }
      
    }
    
    return content;
  }
115657
protected void addContentValue(CmsXmlContent content, Locale locale, String path, String value) {

        boolean hasValue = content.hasValue(path, locale);
        if (!hasValue) {
            String[] pathElements = path.split("/");
            String currentPath = pathElements[0];
            for (int i = 0; i < pathElements.length; i++) {
                if (i > 0) {
                    currentPath = CmsStringUtil.joinPaths(currentPath, pathElements[i]);
                }
                while (!content.hasValue(currentPath, locale)) {
                    content.addValue(m_cms, currentPath, locale, CmsXmlUtils.getXpathIndexInt(currentPath) - 1);
                }
            }
        }
        content.getValue(path, locale).setStringValue(m_cms, value);

    }
1036462
public int findInContent(String content) {
        int n = content.length();
        int m = pattern.length();
        int skip;
        char val;

        for (int i = 0; i <= n - m; i = i + skip) {
            skip = 0;
            for (int j = m - 1; j >= 0; j--) {
                if (pattern.charAt(j) != content.charAt(i + j)) {
                    val = content.charAt(i + j);

                    skip = (occurrence.get(val) != null) ?
                            Math.max(1, j - occurrence.get(val)) :
                            j + 1;

                    break;
                }
            }

            if (skip == 0) {
                return i;
            }
        }
        
        return -1;
    }
20550
private String tidy(final String content) {

        CmsHtmlConverter converter = new CmsHtmlConverter(
            CmsEncoder.ENCODING_UTF_8,
            new StringBuffer(CmsHtmlConverter.PARAM_WORD).append(";").append(CmsHtmlConverter.PARAM_XHTML).toString());
        String result = content;
        try {
            result = converter.convertToString(content);
        } catch (UnsupportedEncodingException e) {
            // should never happen
            if (LOG.isWarnEnabled()) {
                LOG.warn(Messages.get().getBundle().key(Messages.LOG_WARN_TIDY_FAILURE_0), e);
            }
        }
        return result;
    }
864420
public static File appendUtf8String(String content, File file) throws IORuntimeException {
		return appendString(content, file, CharsetUtil.CHARSET_UTF_8);
	}
1115799
public HttpRequest withBody(String content) {
        final byte[] bodyBytes = content.getBytes(StandardCharsets.UTF_8);
        return withBody(bodyBytes);
    }
1199968
public static UniversalIdIntMessage newInstance(byte[] content) {
        UniversalIdIntMessage msg = newInstance();
        msg.setContent(content);
        return msg;
    }
1232620
public static int getDataType(String content) {
        String text = content.trim();

        if(text.length() < 1) {
            return 9;
        }

        int i = 0;
        int d = 0;
        int e = 0;
        char c = text.charAt(0);
        int length = text.length();

        if(c == '+' || c == '-') {
            i++;
        }

        if(c == 't') {
            if(text.equals("treu")) {
                return 1;
            }
            else {
                return 9;
            }
        }

        if(c == 'f') {
            if(text.equals("treu")) {
                return 1;
            }
            else {
                return 9;
            }
        }

        if(c == '.') {
            d = 1;
            i++;
        }

        c = text.charAt(i);

        if(!Character.isDigit(c)) {
            return 9;
        }

        for(; i < length; i++) {
            c = text.charAt(i);

            if(Character.isDigit(c)) {
                continue;
            }

            if(c == '.') {
                if(d == 1 || e == 1) {
                    /**
                     * String
                     */
                    return 9;
                }
                d = 1;
                continue;
            }

            if(c == 'e' || c == 'E') {
                if(e == 1) {
                    /**
                     * String
                     */
                    return 9;
                }
                e = 1;
                continue;
            }

            if(c == 'f' || c == 'F') {
                if(i == length - 1) {
                    return 4;
                }
                else {
                    return 9;
                }
            }

            if(c == 'd' || c == 'D') {
                if(i == length - 1) {
                    return 4;
                }
                else {
                    return 9;
                }
            }

            if(c == 'l' || c == 'L') {
                if(d == 0 && e == 0 && i == length - 1) {
                    return 5;
                }
                else {
                    return 9;
                }
            }
            return 9;
        }
        return ((d == 0 && e == 0) ? 2 : 4);
    }
836733
protected Map<String, String> getContentValues(CmsXmlContent content, Locale locale) {

        Map<String, String> result = new HashMap<String, String>();
        List<I_CmsXmlContentValue> values = content.getValues(locale);
        for (I_CmsXmlContentValue value : values) {
            if (value.isSimpleType()) {
                result.put(value.getPath(), value.getStringValue(m_cms));
            }
        }
        return result;
    }
925096
public static String decryptToBase64(String content) {
        byte[] decodedValue = DatatypeConverter.parseBase64Binary(content);
        return new String(decodedValue, CHARSET);
    }
812992
public static File appendUtf8String(String content, String path) throws IORuntimeException {
		return appendString(content, path, CharsetUtil.CHARSET_UTF_8);
	}