/** * Returns whether the characters in the StringBuffer {@code strbuf} are the * same as those in this string. * * @param strbuf * the StringBuffer to compare this string to. * @return {@code true} if the characters in {@code strbuf} are identical to * those in this string. If they are not, {@code false} will be * returned. * @throws NullPointerException * if {@code strbuf} is {@code null}. * @since 1.4 */ public boolean contentEquals(StringBuffer strbuf) { synchronized (strbuf) { int size = strbuf.length(); if (count != size) { return false; } return regionMatches(0, new String(0, size, strbuf.getValue()), 0, size); } }
/** * Appends the contents of the specified {@code StringBuffer}. If the * StringBuffer is {@code null}, then the string {@code "null"} is * appended. * * @param sb * the {@code StringBuffer} to append. * @return this builder. */ public StringBuilder append(StringBuffer sb) { if (sb == null) { appendNull(); } else { append0(sb.getValue(), 0, sb.length()); } return this; }
/** * Adds the specified StringBuffer to the end of this buffer. * <p> * If the specified StringBuffer is {@code null} the string {@code "null"} * is appended, otherwise the contents of the specified StringBuffer is * appended. * * @param sb * the StringBuffer to append (may be null). * @return this StringBuffer. * * @since 1.4 */ public synchronized StringBuffer append(StringBuffer sb) { if (sb == null) { appendNull(); } else { synchronized (sb) { append0(sb.getValue(), 0, sb.length()); } } return this; }
private synchronized void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("count", length()); fields.put("shared", false); fields.put("value", getValue()); out.writeFields(); }
/** * Returns whether the characters in the StringBuffer {@code strbuf} are the * same as those in this string. * * @param strbuf * the StringBuffer to compare this string to. * @return {@code true} if the characters in {@code strbuf} are identical to * those in this string. If they are not, {@code false} will be * returned. * @throws NullPointerException * if {@code strbuf} is {@code null}. * @since 1.4 */ public boolean contentEquals(StringBuffer strbuf) { synchronized (strbuf) { int size = strbuf.length(); if (count != size) { return false; } return regionMatches(0, new String(0, size, strbuf.getValue()), 0, size); } }
/** * Returns whether the characters in the StringBuffer {@code strbuf} are the * same as those in this string. * * @param strbuf * the StringBuffer to compare this string to. * @return {@code true} if the characters in {@code strbuf} are identical to * those in this string. If they are not, {@code false} will be * returned. * @throws NullPointerException * if {@code strbuf} is {@code null}. * @since 1.4 */ public boolean contentEquals(StringBuffer strbuf) { synchronized (strbuf) { int size = strbuf.length(); if (count != size) { return false; } return regionMatches(0, new String(0, size, strbuf.getValue()), 0, size); } }
/** * Returns whether the characters in the StringBuffer {@code strbuf} are the * same as those in this string. * * @param strbuf * the StringBuffer to compare this string to. * @return {@code true} if the characters in {@code strbuf} are identical to * those in this string. If they are not, {@code false} will be * returned. * @throws NullPointerException * if {@code strbuf} is {@code null}. * @since 1.4 */ public boolean contentEquals(StringBuffer strbuf) { synchronized (strbuf) { int size = strbuf.length(); if (count != size) { return false; } return regionMatches(0, new String(0, size, strbuf.getValue()), 0, size); } }
/** * Appends the contents of the specified {@code StringBuffer}. If the * StringBuffer is {@code null}, then the string {@code "null"} is * appended. * * @param sb * the {@code StringBuffer} to append. * @return this builder. */ public StringBuilder append(StringBuffer sb) { if (sb == null) { appendNull(); } else { append0(sb.getValue(), 0, sb.length()); } return this; }
/** * Appends the contents of the specified {@code StringBuffer}. If the * StringBuffer is {@code null}, then the string {@code "null"} is * appended. * * @param sb * the {@code StringBuffer} to append. * @return this builder. */ public StringBuilder append(StringBuffer sb) { if (sb == null) { appendNull(); } else { append0(sb.getValue(), 0, sb.length()); } return this; }
/** * Appends the contents of the specified {@code StringBuffer}. If the * StringBuffer is {@code null}, then the string {@code "null"} is * appended. * * @param sb * the {@code StringBuffer} to append. * @return this builder. */ public StringBuilder append(StringBuffer sb) { if (sb == null) { appendNull(); } else { append0(sb.getValue(), 0, sb.length()); } return this; }
/** * Appends the contents of the specified {@code StringBuffer}. If the * StringBuffer is {@code null}, then the string {@code "null"} is * appended. * * @param sb * the {@code StringBuffer} to append. * @return this builder. */ public StringBuilder append(StringBuffer sb) { if (sb == null) { appendNull(); } else { append0(sb.getValue(), 0, sb.length()); } return this; }
/** * Appends the contents of the specified {@code StringBuffer}. If the * StringBuffer is {@code null}, then the string {@code "null"} is * appended. * * @param sb * the {@code StringBuffer} to append. * @return this builder. */ public StringBuilder append(StringBuffer sb) { if (sb == null) { appendNull(); } else { append0(sb.getValue(), 0, sb.length()); } return this; }
/** * Appends the contents of the specified {@code StringBuffer}. If the * StringBuffer is {@code null}, then the string {@code "null"} is * appended. * * @param sb * the {@code StringBuffer} to append. * @return this builder. */ public StringBuilder append(StringBuffer sb) { if (sb == null) { appendNull(); } else { append0(sb.getValue(), 0, sb.length()); } return this; }
/** * Adds the specified StringBuffer to the end of this buffer. * <p> * If the specified StringBuffer is {@code null} the string {@code "null"} * is appended, otherwise the contents of the specified StringBuffer is * appended. * * @param sb * the StringBuffer to append (may be null). * @return this StringBuffer. * * @since 1.4 */ public synchronized StringBuffer append(StringBuffer sb) { if (sb == null) { appendNull(); } else { synchronized (sb) { append0(sb.getValue(), 0, sb.length()); } } return this; }
private synchronized void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("count", length()); fields.put("shared", false); fields.put("value", getValue()); out.writeFields(); }
private synchronized void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("count", length()); fields.put("shared", false); fields.put("value", getValue()); out.writeFields(); }
private synchronized void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("count", length()); fields.put("shared", false); fields.put("value", getValue()); out.writeFields(); }
private synchronized void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("count", length()); fields.put("shared", false); fields.put("value", getValue()); out.writeFields(); }
private synchronized void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("count", length()); fields.put("shared", false); fields.put("value", getValue()); out.writeFields(); }
private synchronized void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("count", length()); fields.put("shared", false); fields.put("value", getValue()); out.writeFields(); }