Package ariba.util.core

Examples of ariba.util.core.FastStringBuffer


                ListUtil.list()));
    }

    private String getErrorString (List errors)
    {
        FastStringBuffer buffer = new FastStringBuffer(200);
        for (int i=0; i < errors.size(); i++) {
            buffer.append("Error :\n");
            buffer.append(errors.get(i).toString());
            buffer.append("\n");
        }
        return buffer.toString();
    }
View Full Code Here


        }
    }

    protected static String spaces (int n)
    {
        FastStringBuffer buf = new FastStringBuffer(n);
        while (n-- >= 0) buf.append(' ');
        return buf.toString();
    }
View Full Code Here

        }
    }

    private static FastStringBuffer getTextBuffer (Node parent)
    {
        FastStringBuffer buffer = new FastStringBuffer();

        NodeList childNodes = parent.getChildNodes();
        int  listSize = childNodes.getLength();
        boolean found = false;

        for (int i = 0; i < listSize; i++) {
            Node childNode = childNodes.item(i);

            if (childNode.getNodeType() == Node.COMMENT_NODE) {
                continue;
            }

            if (childNode.getNodeType() == Node.TEXT_NODE ||
                childNode.getNodeType() == Node.CDATA_SECTION_NODE) {

                buffer.append(((CharacterData)childNode).getData());
                found = true;
            }
            else if (childNode.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
                FastStringBuffer refResult = getTextBuffer(childNode);
                if (refResult != null) {
                    buffer.append(refResult);
                    found = true;
                }
            }
View Full Code Here

        }
    }
   
    public static String getText (Element parent, String theDefault)
    {
        FastStringBuffer result = getTextBuffer(parent);

        // if there was empty content return default
        if (result == null) {
            return theDefault;
        }

        return result.toString();
    }
View Full Code Here

    static class ErrorReporter implements ErrorHandler
    {
        public void warning (SAXParseException e)
        {
            FastStringBuffer buf = new FastStringBuffer();
            buf.append("** ");
            buf.append("Warning");
            buf.append("\n   URI = ");
            buf.append(e.getSystemId());
            buf.append(" Line = ");
            buf.append(ariba.util.core.Constants.getInteger(e.getLineNumber()).toString());
            buf.append("\n   Message = ");
            buf.append(e.getMessage());
            ariba.util.log.Log.util.debug("%s",buf);
        }
View Full Code Here

        }
    }

    public String _debugSemanticKeyPrefix ()
    {
        FastStringBuffer sb = null;
        int currentLevel = _semanticKeyPrefixes.inUse() - 1;
        String[] array = _semanticKeyPrefixes.array();
        for (int index = 0; index <= currentLevel; index++) {
            String prefix = array[index];
            if (prefix != null) {
                if (sb == null) {
                    sb = new FastStringBuffer(prefix);
                }
                else {
                    sb.append("_");
                    sb.append(prefix);
                }
            }
        }
        return sb == null ? null : sb.toString();
    }
View Full Code Here

        return getKeysAsString(keys);
    }

    public static String getKeysAsString (Object[] keys)
    {
        FastStringBuffer fsb = new FastStringBuffer();
        fsb.append("[");
        for (int i = 0; i < keys.length; i++) {
            if (i > 0) {
                fsb.append(", ");
            }
            Object key = keys[i];
            if (key instanceof String && key.equals(NullKey)) {
                fsb.append("");
            }
            else if (key instanceof String) {
                if (((String)key).length() < 20) {
                    fsb.append(key);
                }
                else {
                    fsb.append(Fmt.S("%s...@%s",
                        ((String)key).substring(0, 20),
                        Integer.toString(System.identityHashCode(key))));
                }
            }
            else {
                fsb.append(Fmt.S("%s@%s", key.getClass().getName(),
                    Integer.toString(System.identityHashCode(key))));
            }
        }
        fsb.append("]");

        return fsb.toString();
    }
View Full Code Here

    private String getMaskedValue (String value)
    {
        if (_indicateLength) {
            int length = value.length();
            FastStringBuffer buffer = new FastStringBuffer(length);
            for (int i = 0; i < length; i++) {
                buffer.append("*");
            }
            return buffer.toString();
        }
        return MaskedValue;
    }
View Full Code Here

    }

    void pushString (String stringValue)
    {
        if (_currentStringBuffer == null) {
            _currentStringBuffer = new FastStringBuffer();
        }
        String strippedStringValue = stripFormattingWhitespace(stringValue);
        _currentStringBuffer.append(strippedStringValue);
    }
View Full Code Here

    private String removeBackslashes (String dirtyString)
    {
        String cleanString = dirtyString;
        if (dirtyString.indexOf('\\') != -1) {
            int dirtyStringLength = dirtyString.length();
            FastStringBuffer stringBuffer = new FastStringBuffer(dirtyStringLength);
            for (int index = 0; index < dirtyStringLength; index++) {
                char currentChar = dirtyString.charAt(index);
                if (currentChar == '\\') {
                    index++;
                    if (index < dirtyStringLength) {
                        currentChar = dirtyString.charAt(index);
                    }
                }
                stringBuffer.append(currentChar);
            }
            cleanString = stringBuffer.toString();
        }
        return cleanString;
    }
View Full Code Here

TOP

Related Classes of ariba.util.core.FastStringBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.