public char charAt(final int index) { if (index < this.prefix.length()) { return this.prefix.charAt(index); } final int prefixedContentLen = this.prefix.length() + getContentLength(); if (index >= prefixedContentLen) { return this.suffix.charAt(index - prefixedContentLen); } return charAtContent(index - this.prefix.length()); }
public CharSequence subSequence(final int start, final int end) { // First we will try to avoid computing the complete String if (start >= this.prefix.length() && end < (this.prefix.length() + getContentLength())) { return contentSubSequence((start - this.prefix.length()), (end - this.prefix.length())); } return getCDATASection().subSequence(start, end); }
public String getCDATASection() { String c = this.computedCDATASectionStr; if (c == null) { this.computedCDATASectionStr = c = this.prefix + getContentText() + this.suffix; } return c; }
CDATASection cdataSection = CDATASection.asEngineCDATASection(icdataSection); cdataSection = new CDATASection(cdataSection.prefix, structureHandler.setContentValue, cdataSection.suffix);
@Override public void handleCDATASection( final char[] buffer, final int contentOffset, final int contentLen, final int outerOffset, final int outerLen, final int line, final int col) throws ParseException { final String prefix = new String(buffer, outerOffset, (contentOffset - outerOffset)); final String content = new String(buffer, contentOffset, contentLen); final String suffix = new String(buffer, contentOffset + contentLen, (outerOffset + outerLen) - (contentOffset + contentLen)); this.templateHandler.handleCDATASection( new CDATASection(prefix, content, suffix, this.templateName, this.lineOffset + line, (line == 1? this.colOffset : 0) + col)); }
@Override public void handleCDATASection(final ICDATASection cdataSection) { this.events.add(CDATASection.asEngineCDATASection(cdataSection)); // The engine event we might have created is not forwarded - this makes cache creating transparent to the handler chain super.handleCDATASection(cdataSection); }
@Override public String toString() { return getCDATASection(); }
public void write(final Writer writer) throws IOException { writer.write(this.prefix); writeContent(writer); writer.write(this.suffix); }
public int length() { return this.prefix.length() + getContentLength() + this.suffix.length(); }
public static boolean isWhitespace(final ICDATASection cdataSection) { if (cdataSection == null) { return false; } if (cdataSection instanceof CDATASection) { return ((CDATASection) cdataSection).isWhitespace(); } return computeWhitespace(cdataSection.getContent()); }
public static boolean isInlineable(final ICDATASection cdataSection) { if (cdataSection == null) { return false; } if (cdataSection instanceof CDATASection) { return ((CDATASection) cdataSection).isInlineable(); } return computeInlineable(cdataSection.getContent()); }
public ICDATASection createCDATASection(final CharSequence content) { checkRestrictedEventForTextTemplateMode("CDATASection"); return new CDATASection(content); }
return CDATASection.asEngineCDATASection((ICDATASection) event);
static CDATASection asEngineCDATASection(final ICDATASection cdataSection) { if (cdataSection instanceof CDATASection) { return (CDATASection) cdataSection; } return new CDATASection(cdataSection.getContent(), cdataSection.getTemplateName(), cdataSection.getLine(), cdataSection.getCol()); }
public String getContent() { return getContentText(); }