org.yaml.snakeyaml.scanner.Constant Java Examples
The following examples show how to use
org.yaml.snakeyaml.scanner.Constant.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StreamReader.java From orion.server with Eclipse Public License 1.0 | 6 votes |
/** * read the next length characters and move the pointer. * * @param length */ public void forward(int length) { if (this.pointer + length + 1 >= this.buffer.length()) { update(); } char ch = 0; for (int i = 0; i < length; i++) { ch = this.buffer.charAt(this.pointer); this.pointer++; this.index++; if (Constant.LINEBR.has(ch) || (ch == '\r' && buffer.charAt(pointer) != '\n')) { this.line++; this.column = 0; } else if (ch != '\uFEFF') { this.column++; } } }
Example #2
Source File: StreamReader.java From snake-yaml with Apache License 2.0 | 6 votes |
/** * read the next length characters and move the pointer. * * @param length */ public void forward(int length) { if (this.pointer + length + 1 >= this.buffer.length()) { update(); } char ch = 0; for (int i = 0; i < length; i++) { ch = this.buffer.charAt(this.pointer); this.pointer++; this.index++; if (Constant.LINEBR.has(ch) || (ch == '\r' && buffer.charAt(pointer) != '\n')) { this.line++; this.column = 0; } else if (ch != '\uFEFF') { this.column++; } } }
Example #3
Source File: Emitter.java From Diorite with MIT License | 6 votes |
private String determineBlockHints(String text) { StringBuilder hints = new StringBuilder(); // if (Constant.LINEBR.has(text.charAt(0), " ")) disabled, always add indent marker to prevent formatting problems. { hints.append(this.bestIndent); } char ch1 = text.charAt(text.length() - 1); if (Constant.LINEBR.hasNo(ch1)) { hints.append("-"); } else if ((text.length() == 1) || Constant.LINEBR.has(text.charAt(text.length() - 2))) { hints.append("+"); } return hints.toString(); }
Example #4
Source File: Emitter.java From orion.server with Eclipse Public License 1.0 | 5 votes |
private String determineBlockHints(String text) { StringBuilder hints = new StringBuilder(); if (Constant.LINEBR.has(text.charAt(0), " ")) { hints.append(bestIndent); } char ch1 = text.charAt(text.length() - 1); if (Constant.LINEBR.hasNo(ch1)) { hints.append("-"); } else if (text.length() == 1 || Constant.LINEBR.has(text.charAt(text.length() - 2))) { hints.append("+"); } return hints.toString(); }
Example #5
Source File: Emitter.java From snake-yaml with Apache License 2.0 | 5 votes |
private String determineBlockHints(String text) { StringBuilder hints = new StringBuilder(); if (Constant.LINEBR.has(text.charAt(0), " ")) { hints.append(bestIndent); } char ch1 = text.charAt(text.length() - 1); if (Constant.LINEBR.hasNo(ch1)) { hints.append("-"); } else if (text.length() == 1 || Constant.LINEBR.has(text.charAt(text.length() - 2))) { hints.append("+"); } return hints.toString(); }
Example #6
Source File: Mark.java From orion.server with Eclipse Public License 1.0 | 4 votes |
private boolean isLineBreak(char ch) { return Constant.NULL_OR_LINEBR.has(ch); }
Example #7
Source File: Emitter.java From orion.server with Eclipse Public License 1.0 | 4 votes |
void writeLiteral(String text) throws IOException { String hints = determineBlockHints(text); writeIndicator("|" + hints, true, false, false); if (hints.length() > 0 && (hints.charAt(hints.length() - 1)) == '+') { openEnded = true; } writeLineBreak(null); boolean breaks = true; int start = 0, end = 0; while (end <= text.length()) { char ch = 0; if (end < text.length()) { ch = text.charAt(end); } if (breaks) { if (ch == 0 || Constant.LINEBR.hasNo(ch)) { String data = text.substring(start, end); for (char br : data.toCharArray()) { if (br == '\n') { writeLineBreak(null); } else { writeLineBreak(String.valueOf(br)); } } if (ch != 0) { writeIndent(); } start = end; } } else { if (ch == 0 || Constant.LINEBR.has(ch)) { stream.write(text, start, end - start); if (ch == 0) { writeLineBreak(null); } start = end; } } if (ch != 0) { breaks = (Constant.LINEBR.has(ch)); } end++; } }
Example #8
Source File: Mark.java From snake-yaml with Apache License 2.0 | 4 votes |
private boolean isLineBreak(char ch) { return Constant.NULL_OR_LINEBR.has(ch); }
Example #9
Source File: Emitter.java From snake-yaml with Apache License 2.0 | 4 votes |
void writeLiteral(String text) throws IOException { String hints = determineBlockHints(text); writeIndicator("|" + hints, true, false, false); if (hints.length() > 0 && (hints.charAt(hints.length() - 1)) == '+') { openEnded = true; } writeLineBreak(null); boolean breaks = true; int start = 0, end = 0; while (end <= text.length()) { char ch = 0; if (end < text.length()) { ch = text.charAt(end); } if (breaks) { if (ch == 0 || Constant.LINEBR.hasNo(ch)) { String data = text.substring(start, end); for (char br : data.toCharArray()) { if (br == '\n') { writeLineBreak(null); } else { writeLineBreak(String.valueOf(br)); } } if (ch != 0) { writeIndent(); } start = end; } } else { if (ch == 0 || Constant.LINEBR.has(ch)) { stream.write(text, start, end - start); if (ch == 0) { writeLineBreak(null); } start = end; } } if (ch != 0) { breaks = Constant.LINEBR.has(ch); } end++; } }
Example #10
Source File: Emitter.java From Diorite with MIT License | 4 votes |
void writeLiteral(String text) throws IOException { String hints = this.determineBlockHints(text); this.writeIndicator("|" + hints, true, false, false); if (! hints.isEmpty() && ((hints.charAt(hints.length() - 1)) == '+')) { this.openEnded = true; } this.writeLineBreak(null); boolean breaks = true; int start = 0, end = 0; while (end <= text.length()) { char ch = 0; if (end < text.length()) { ch = text.charAt(end); } if (breaks) { if ((ch == 0) || Constant.LINEBR.hasNo(ch)) { String data = text.substring(start, end); for (char br : data.toCharArray()) { if (br == '\n') { this.writeLineBreak(null); } else { this.writeLineBreak(String.valueOf(br)); } } if (ch != 0) { this.writeIndent(); } start = end; } } else { if ((ch == 0) || Constant.LINEBR.has(ch)) { this.stream.write(text, start, end - start); if (ch == 0) { this.writeLineBreak(null); } start = end; } } if (ch != 0) { breaks = Constant.LINEBR.has(ch); } end++; } }