private int getContentUntilNextTag(StringBuffer buffer) throws IOException { int c= nextChar(); boolean blockStartRead= false; while (c != -1) { if (c == '@') { int index= buffer.length(); while (--index >= 0 && Character.isWhitespace(buffer.charAt(index))) { switch (buffer.charAt(index)) { case '\n': case '\r': return c; } if (index <= 0) { return c; } } } if (blockStartRead) { buffer.append(processBlockTag()); blockStartRead= false; } else { buffer.append((char) c); } c= nextChar(); blockStartRead= c == '{'; } return c; }
private int getContentUntilNextTag(StringBuilder buffer) throws IOException { int c= nextChar(); boolean blockStartRead= false; while (c != -1) { if (c == '@') { int index= buffer.length(); while (--index >= 0 && Character.isWhitespace(buffer.charAt(index))) { switch (buffer.charAt(index)) { case '\n': case '\r': return c; } if (index <= 0) { return c; } } } if (blockStartRead) { buffer.append(processBlockTag()); blockStartRead= false; } else { buffer.append((char) c); } c= nextChar(); blockStartRead= c == '{'; } return c; }
private int getContentUntilNextTag(StringBuffer buffer) throws IOException { int c= nextChar(); boolean blockStartRead= false; while (c != -1) { if (c == '@') { int index= buffer.length(); while (--index >= 0 && Character.isWhitespace(buffer.charAt(index))) { switch (buffer.charAt(index)) { case '\n': case '\r': return c; } if (index <= 0) { return c; } } } if (blockStartRead) { buffer.append(processBlockTag()); blockStartRead= false; } else { buffer.append((char) c); } c= nextChar(); blockStartRead= c == '{'; } return c; }
private String processBlockTag() throws IOException { int c= nextChar(); if (c != '@') { StringBuilder buffer= new StringBuilder(); buffer.append('{'); buffer.append((char) c); return buffer.toString(); } StringBuilder buffer= new StringBuilder(); if (c != -1) { buffer.setLength(0); buffer.append((char) c); c= getTag(buffer); String tag= buffer.toString(); buffer.setLength(0); if (c != -1 && c != '}') { buffer.append((char) c); c= getContent(buffer, '}'); } return printBlockTag(tag, buffer.toString()); } return null; }
private String processBlockTag() throws IOException { int c= nextChar(); if (c != '@') { StringBuffer buffer= new StringBuffer(); buffer.append('{'); buffer.append((char) c); return buffer.toString(); } StringBuffer buffer= new StringBuffer(); if (c != -1) { buffer.setLength(0); buffer.append((char) c); c= getTag(buffer); String tag= buffer.toString(); buffer.setLength(0); if (c != -1 && c != '}') { buffer.append((char) c); c= getContent(buffer, '}'); } return printBlockTag(tag, buffer.toString()); } return null; }
private String processBlockTag() throws IOException { int c= nextChar(); if (c != '@') { StringBuffer buffer= new StringBuffer(); buffer.append('{'); buffer.append((char) c); return buffer.toString(); } StringBuffer buffer= new StringBuffer(); if (c != -1) { buffer.setLength(0); buffer.append((char) c); c= getTag(buffer); String tag= buffer.toString(); buffer.setLength(0); if (c != -1 && c != '}') { buffer.append((char) c); c= getContent(buffer, '}'); } return printBlockTag(tag, buffer.toString()); } return null; }