Package com.fasterxml.aalto.util

Examples of com.fasterxml.aalto.util.TextAccumulator


            }
            break;
        }
        String text = _scanner.getText();
        // Then we'll see if end is nigh...
        TextAccumulator acc = null;
        int type;
       
        while ((type = next()) != END_ELEMENT) {
            if (((1 << type) & MASK_GET_ELEMENT_TEXT) != 0) {
                if (acc == null) {
                    acc = new TextAccumulator();
                    acc.addText(text);
                }
                acc.addText(getText());
                continue;
            }
            if (type != COMMENT && type != PROCESSING_INSTRUCTION) {
                throwWfe("Expected a text token, got "+ErrorConsts.tokenTypeDesc(type)+".");
            }
        }
        return (acc == null) ? text : acc.getAndClear();
    }
View Full Code Here


            }
            break;
        }
        String text = _scanner.getText();
        // Then we'll see if end is nigh...
        TextAccumulator acc = null;
        int type;
       
        while ((type = next()) != END_ELEMENT) {
            if (((1 << type) & MASK_GET_ELEMENT_TEXT) != 0) {
                if (acc == null) {
                    acc = new TextAccumulator();
                    acc.addText(text);
                }
                acc.addText(getText());
                continue;
            }
            if (type != COMMENT && type != PROCESSING_INSTRUCTION) {
                throwWfe("Expected a text token, got "+ErrorConsts.tokenTypeDesc(type)+".");
            }
        }
        return (acc == null) ? text : acc.getAndClear();
    }
View Full Code Here

public class TestTextAccumulator
    extends TestCase
{
    public void testBasic()
    {
        TextAccumulator acc = new TextAccumulator();

        acc.addText("foo");
        assertEquals("foo", acc.getAndClear());

        acc.addText("foo".toCharArray(), 0, 3);
        acc.addText("bar");
        assertEquals("foobar", acc.getAndClear());
    }
View Full Code Here

    }

    // as per [WSTX-349]
    public void testBasicWithCharArray()
    {
        TextAccumulator acc = new TextAccumulator();

        acc.addText("foobar".toCharArray(), 3, 5);
        assertEquals("ba", acc.getAndClear());

        acc.addText("xxfoo".toCharArray(), 2, 5);
        acc.addText("bar".toCharArray(), 2, 3);
        acc.addText(new char[] { '1', '2', '3' }, 2, 3);
        assertEquals("foor3", acc.getAndClear());

        acc.addText("a");
        acc.addText(new char[] { '1', '2', '3' }, 2, 3);
        assertEquals("a3", acc.getAndClear());
    }
View Full Code Here

            }
            break;
        }
        String text = _scanner.getText();
        // Then we'll see if end is nigh...
        TextAccumulator acc = null;
        int type;
       
        while ((type = next()) != END_ELEMENT) {
            if (((1 << type) & MASK_GET_ELEMENT_TEXT) != 0) {
                if (acc == null) {
                    acc = new TextAccumulator();
                    acc.addText(text);
                }
                acc.addText(getText());
                continue;
            }
            if (type != COMMENT && type != PROCESSING_INSTRUCTION) {
                _reportNonTextEvent(type);
            }
        }
        return (acc == null) ? text : acc.getAndClear();
    }
View Full Code Here

            }
            break;
        }
        String text = _scanner.getText();
        // Then we'll see if end is nigh...
        TextAccumulator acc = null;
        int type;
       
        while ((type = next()) != END_ELEMENT) {
            if (((1 << type) & MASK_GET_ELEMENT_TEXT) != 0) {
                if (acc == null) {
                    acc = new TextAccumulator();
                    acc.addText(text);
                }
                acc.addText(getText());
                continue;
            }
            if (type != COMMENT && type != PROCESSING_INSTRUCTION) {
                throwWfe("Expected a text token, got "+ErrorConsts.tokenTypeDesc(type)+".");
            }
        }
        return (acc == null) ? text : acc.getAndClear();
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.aalto.util.TextAccumulator

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.