/** * Same like next(), but returns the End-Of-Text as * if there was a linebreak added (Reader.readLine() compatible) * * @return The next position. */ public int nextWithEnd() { final int pos = this.position; if (pos == DONE) { return DONE; } if (pos == this.text.length) { this.position = DONE; return DONE; } final int retval = nextPosition(); if (retval == DONE) { return this.text.length; } return retval; }
/** * Creates a new line break iterator. * * @param text the text to be broken up. */ public LineBreakIterator(final String text) { setText(text); }
/** * Writes a descriptive comment into the given print writer. * * @param text the text to be written. If it contains more than * one line, every line will be prepended by the comment character. * @param writer the writer that should receive the content. * @throws IOException if writing fails */ private void writeDescription(final String text, final Writer writer) throws IOException { // check if empty content ... this case is easy ... if (text.length() == 0) { return; } writer.write("# "); writer.write(END_OF_LINE); final LineBreakIterator iterator = new LineBreakIterator(text); while (iterator.hasNext()) { writer.write("# "); saveConvert((String) iterator.next(), ESCAPE_COMMENT, writer); writer.write(END_OF_LINE); } }
int pos = nextWithEnd(); if (pos == DONE)
/** * Writes a descriptive comment into the given print writer. * * @param text the text to be written. If it contains more than * one line, every line will be prepended by the comment character. * @param writer the writer that should receive the content. * @throws IOException if writing fails */ private void writeDescription(final String text, final Writer writer) throws IOException { // check if empty content ... this case is easy ... if (text.length() == 0) { return; } writer.write("# "); writer.write(END_OF_LINE); final LineBreakIterator iterator = new LineBreakIterator(text); while (iterator.hasNext()) { writer.write("# "); saveConvert((String) iterator.next(), ESCAPE_COMMENT, writer); writer.write(END_OF_LINE); } }
int pos = nextWithEnd(); if (pos == DONE)
/** * Writes a descriptive comment into the given print writer. * * @param text the text to be written. If it contains more than * one line, every line will be prepended by the comment character. * @param writer the writer that should receive the content. * @throws IOException if writing fails */ private void writeDescription(final String text, final Writer writer) throws IOException { // check if empty content ... this case is easy ... if (text.length() == 0) { return; } writer.write("# "); writer.write(END_OF_LINE); final LineBreakIterator iterator = new LineBreakIterator(text); while (iterator.hasNext()) { writer.write("# "); saveConvert((String) iterator.next(), ESCAPE_COMMENT, writer); writer.write(END_OF_LINE); } }
/** * Creates a new line break iterator. * * @param text the text to be broken up. */ public LineBreakIterator(final String text) { setText(text); }
/** * Same like next(), but returns the End-Of-Text as * if there was a linebreak added (Reader.readLine() compatible) * * @return The next position. */ public int nextWithEnd() { final int pos = this.position; if (pos == DONE) { return DONE; } if (pos == this.text.length) { this.position = DONE; return DONE; } final int retval = nextPosition(); if (retval == DONE) { return this.text.length; } return retval; }
int pos = nextWithEnd(); if (pos == DONE)
/** * Default constructor. */ public LineBreakIterator() { setText(""); }
/** * Same like next(), but returns the End-Of-Text as * if there was a linebreak added (Reader.readLine() compatible) * * @return The next position. */ public int nextWithEnd() { final int pos = this.position; if (pos == DONE) { return DONE; } if (pos == this.text.length) { this.position = DONE; return DONE; } final int retval = nextPosition(); if (retval == DONE) { return this.text.length; } return retval; }
/** * Default constructor. */ public LineBreakIterator() { setText(""); }
/** * Default constructor. */ public LineBreakIterator() { setText(""); }
/** * Creates a new line break iterator. * * @param text the text to be broken up. */ public LineBreakIterator(final String text) { setText(text); }