/** {@inheritDoc} */ @Override public void write(char[] cbuf, int off, int len) throws IOException { synchronized (lock) { while (len > 0) { write(cbuf[off]); off++; len--; } } }
int len2 = s2.length(); StringWriter sw = new StringWriter(len2 * 2); IndentingWriter iw = new IndentingWriter(sw, w2, separator); iw.write(s2); if ((len2 == 0) || (s2.charAt(len2 - 1) != '\n')) { iw.write('\n'); iw.flush();
/** * Constructs an instance. * * @param out {@code non-null;} writer to send final output to * @param width {@code >= 0;} the maximum output width (not including * {@code prefix}), or {@code 0} for no maximum * @param prefix {@code non-null;} the prefix for each line */ public IndentingWriter(Writer out, int width, String prefix) { super(out); if (out == null) { throw new NullPointerException("out == null"); } if (width < 0) { throw new IllegalArgumentException("width < 0"); } if (prefix == null) { throw new NullPointerException("prefix == null"); } this.width = (width != 0) ? width : Integer.MAX_VALUE; this.maxIndent = width >> 1; this.prefix = (prefix.length() == 0) ? null : prefix; bol(); }
this.leftBuf = leftWriter.getBuffer(); this.rightBuf = rightWriter.getBuffer(); this.leftColumn = new IndentingWriter(leftWriter, leftWidth); this.rightColumn = new IndentingWriter(rightWriter, rightWidth, spacer);
int len2 = s2.length(); StringWriter sw = new StringWriter(len2 * 2); IndentingWriter iw = new IndentingWriter(sw, w2, separator); iw.write(s2); if ((len2 == 0) || (s2.charAt(len2 - 1) != '\n')) { iw.write('\n'); iw.flush();
/** * Constructs an instance. * * @param out {@code non-null;} writer to send final output to * @param width {@code >= 0;} the maximum output width (not including * {@code prefix}), or {@code 0} for no maximum * @param prefix {@code non-null;} the prefix for each line */ public IndentingWriter(Writer out, int width, String prefix) { super(out); if (out == null) { throw new NullPointerException("out == null"); } if (width < 0) { throw new IllegalArgumentException("width < 0"); } if (prefix == null) { throw new NullPointerException("prefix == null"); } this.width = (width != 0) ? width : Integer.MAX_VALUE; this.maxIndent = width >> 1; this.prefix = (prefix.length() == 0) ? null : prefix; bol(); }
this.leftBuf = leftWriter.getBuffer(); this.rightBuf = rightWriter.getBuffer(); this.leftColumn = new IndentingWriter(leftWriter, leftWidth); this.rightColumn = new IndentingWriter(rightWriter, rightWidth, spacer);
int len2 = s2.length(); StringWriter sw = new StringWriter(len2 * 2); IndentingWriter iw = new IndentingWriter(sw, w2, separator); iw.write(s2); if ((len2 == 0) || (s2.charAt(len2 - 1) != '\n')) { iw.write('\n'); iw.flush();
/** {@inheritDoc} */ @Override public void write(char[] cbuf, int off, int len) throws IOException { synchronized (lock) { while (len > 0) { write(cbuf[off]); off++; len--; } } }
/** * Constructs an instance. * * @param out {@code non-null;} writer to send final output to * @param width {@code >= 0;} the maximum output width (not including * {@code prefix}), or {@code 0} for no maximum * @param prefix {@code non-null;} the prefix for each line */ public IndentingWriter(Writer out, int width, String prefix) { super(out); if (out == null) { throw new NullPointerException("out == null"); } if (width < 0) { throw new IllegalArgumentException("width < 0"); } if (prefix == null) { throw new NullPointerException("prefix == null"); } this.width = (width != 0) ? width : Integer.MAX_VALUE; this.maxIndent = width >> 1; this.prefix = (prefix.length() == 0) ? null : prefix; bol(); }
this.leftBuf = leftWriter.getBuffer(); this.rightBuf = rightWriter.getBuffer(); this.leftColumn = new IndentingWriter(leftWriter, leftWidth); this.rightColumn = new IndentingWriter(rightWriter, rightWidth, spacer);
int len2 = s2.length(); StringWriter sw = new StringWriter(len2 * 2); IndentingWriter iw = new IndentingWriter(sw, w2, separator); iw.write(s2); if ((len2 == 0) || (s2.charAt(len2 - 1) != '\n')) { iw.write('\n'); iw.flush();
/** {@inheritDoc} */ @Override public void write(char[] cbuf, int off, int len) throws IOException { synchronized (lock) { while (len > 0) { write(cbuf[off]); off++; len--; } } }
/** * Constructs an instance. * * @param out {@code non-null;} writer to send final output to * @param width {@code >= 0;} the maximum output width (not including * {@code prefix}), or {@code 0} for no maximum * @param prefix {@code non-null;} the prefix for each line */ public IndentingWriter(Writer out, int width, String prefix) { super(out); if (out == null) { throw new NullPointerException("out == null"); } if (width < 0) { throw new IllegalArgumentException("width < 0"); } if (prefix == null) { throw new NullPointerException("prefix == null"); } this.width = (width != 0) ? width : Integer.MAX_VALUE; this.maxIndent = width >> 1; this.prefix = (prefix.length() == 0) ? null : prefix; bol(); }
this.leftBuf = leftWriter.getBuffer(); this.rightBuf = rightWriter.getBuffer(); this.leftColumn = new IndentingWriter(leftWriter, leftWidth); this.rightColumn = new IndentingWriter(rightWriter, rightWidth, spacer);
int len2 = s2.length(); StringWriter sw = new StringWriter(len2 * 2); IndentingWriter iw = new IndentingWriter(sw, w2, separator); iw.write(s2); if ((len2 == 0) || (s2.charAt(len2 - 1) != '\n')) { iw.write('\n'); iw.flush();
/** {@inheritDoc} */ @Override public void write(char[] cbuf, int off, int len) throws IOException { synchronized (lock) { while (len > 0) { write(cbuf[off]); off++; len--; } } }
/** * Constructs an instance. * * @param out {@code non-null;} writer to send final output to * @param width {@code >= 0;} the maximum output width (not including * {@code prefix}), or {@code 0} for no maximum * @param prefix {@code non-null;} the prefix for each line */ public IndentingWriter(Writer out, int width, String prefix) { super(out); if (out == null) { throw new NullPointerException("out == null"); } if (width < 0) { throw new IllegalArgumentException("width < 0"); } if (prefix == null) { throw new NullPointerException("prefix == null"); } this.width = (width != 0) ? width : Integer.MAX_VALUE; this.maxIndent = width >> 1; this.prefix = (prefix.length() == 0) ? null : prefix; bol(); }
this.leftBuf = leftWriter.getBuffer(); this.rightBuf = rightWriter.getBuffer(); this.leftColumn = new IndentingWriter(leftWriter, leftWidth); this.rightColumn = new IndentingWriter(rightWriter, rightWidth, spacer);
/** * Does a human-friendly dump of this instance. * * @param out {@code non-null;} where to dump * @param prefix {@code non-null;} prefix to attach to each line of output * @param verbose whether to be verbose; verbose output includes * lines for zero-size instructions and explicit constant pool indices */ public void debugPrint(Writer out, String prefix, boolean verbose) { IndentingWriter iw = new IndentingWriter(out, 0, prefix); int sz = size(); try { for (int i = 0; i < sz; i++) { DalvInsn insn = (DalvInsn) get0(i); String s; if ((insn.codeSize() != 0) || verbose) { s = insn.listingString("", 0, verbose); } else { s = null; } if (s != null) { iw.write(s); } } iw.flush(); } catch (IOException ex) { throw new RuntimeException(ex); } }