/** {@inheritDoc} */ public boolean ready() { return pos < StrBuilder.this.size(); }
/** {@inheritDoc} */ public int read(char b[], int off, int len) { if (off < 0 || len < 0 || off > b.length || (off + len) > b.length || (off + len) < 0) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } if (pos >= StrBuilder.this.size()) { return -1; } if (pos + len > size()) { len = StrBuilder.this.size() - pos; } StrBuilder.this.getChars(pos, pos + len, b, off); pos += len; return len; }
/** * Appends a separator if the builder is currently non-empty. * The separator is appended using {@link #append(char)}. * <p> * This method is useful for adding a separator each time around the * loop except the first. * <pre> * for (Iterator it = list.iterator(); it.hasNext(); ) { * appendSeparator(','); * append(it.next()); * } * </pre> * Note that for this simple example, you should use * {@link #appendWithSeparators(Collection, String)}. * * @param separator the separator to use * @return this, to enable chaining * @since 2.3 */ public StrBuilder appendSeparator(char separator) { if (size() > 0) { append(separator); } return this; }
/** {@inheritDoc} */ protected List tokenize(char[] chars, int offset, int count) { if (chars == null) { return super.tokenize(StrBuilder.this.buffer, 0, StrBuilder.this.size()); } else { return super.tokenize(chars, offset, count); } }
/** * Append one of both separators to the builder * If the builder is currently empty it will append the defaultIfEmpty-separator * Otherwise it will append the standard-separator * * The separator is appended using {@link #append(char)}. * @param standard the separator if builder is not empty * @param defaultIfEmpty the separator if builder is empty * @return this, to enable chaining * @since 2.5 */ public StrBuilder appendSeparator(char standard, char defaultIfEmpty) { if (size() > 0) { append(standard); } else { append(defaultIfEmpty); } return this; } /**
/** {@inheritDoc} */ public boolean ready() { return pos < StrBuilder.this.size(); }
/** {@inheritDoc} */ public boolean ready() { return pos < StrBuilder.this.size(); }
/** {@inheritDoc} */ public boolean ready() { return pos < StrBuilder.this.size(); }
/** {@inheritDoc} */ protected List tokenize(char[] chars, int offset, int count) { if (chars == null) { return super.tokenize(StrBuilder.this.buffer, 0, StrBuilder.this.size()); } else { return super.tokenize(chars, offset, count); } }
/** {@inheritDoc} */ protected List tokenize(char[] chars, int offset, int count) { if (chars == null) { return super.tokenize(StrBuilder.this.buffer, 0, StrBuilder.this.size()); } else { return super.tokenize(chars, offset, count); } }
/** {@inheritDoc} */ protected List tokenize(char[] chars, int offset, int count) { if (chars == null) { return super.tokenize(StrBuilder.this.buffer, 0, StrBuilder.this.size()); } else { return super.tokenize(chars, offset, count); } }
/** {@inheritDoc} */ protected List tokenize(char[] chars, int offset, int count) { if (chars == null) { return super.tokenize(StrBuilder.this.buffer, 0, StrBuilder.this.size()); } else { return super.tokenize(chars, offset, count); } }
/** {@inheritDoc} */ protected List tokenize(char[] chars, int offset, int count) { if (chars == null) { return super.tokenize(StrBuilder.this.buffer, 0, StrBuilder.this.size()); } else { return super.tokenize(chars, offset, count); } }