Package com.psddev.dari.util

Examples of com.psddev.dari.util.LazyWriter


            fieldAccessListener = null;
            BodyContent bodyContent = getBodyContent();
            String oldBody = bodyContent.getString();
            StringWriter newBody = new StringWriter();
            LazyWriter newBodyLazy = new LazyWriter((HttpServletRequest) pageContext.getRequest(), newBody);
            int beginAt;
            int endAt = 0;

            try {
                while ((beginAt = oldBody.indexOf(FIELD_ACCESS_MARKER_BEGIN, endAt)) > -1) {
                    newBodyLazy.write(oldBody.substring(endAt, beginAt));

                    endAt = oldBody.indexOf(FIELD_ACCESS_MARKER_END, beginAt);

                    if (endAt > -1) {
                        newBodyLazy.writeLazily(oldBody.substring(beginAt + FIELD_ACCESS_MARKER_BEGIN.length(), endAt));

                        endAt += FIELD_ACCESS_MARKER_END.length();

                    } else {
                        newBodyLazy.write(oldBody.substring(beginAt, beginAt + FIELD_ACCESS_MARKER_BEGIN.length()));

                        endAt = beginAt + FIELD_ACCESS_MARKER_BEGIN.length();
                    }
                }

                newBodyLazy.write(oldBody.substring(endAt));
                newBodyLazy.writePending();
                bodyContent.clearBody();
                bodyContent.write(newBody.toString());

            } catch (IOException error) {
                // Should never happen when writing to StringWriter.
View Full Code Here

TOP

Related Classes of com.psddev.dari.util.LazyWriter

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.