/** * Write a portion of a String. * * @param s String to be written * @param off Offset from which to start reading characters * @param len Number of characters to be written */ public void write(String s, int off, int len) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(s, off, len); return; } int b = off, t = off + len; while (b < t) { int d = min(getRemaining(), t - b); s.getChars(b, b + d, buf.buf, buf.pos); b += d; buf.pos += d; if (getRemaining() == 0) if (autoFlush) flushBuffer(); else bufferOverflow(); } }
/** * Write a portion of a String. * * @param s String to be written * @param off Offset from which to start reading characters * @param len Number of characters to be written */ public void write(String s, int off, int len) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(s, off, len); return; } int b = off, t = off + len; while (b < t) { int d = min(getRemaining(), t - b); s.getChars(b, b + d, buf.buf, buf.pos); b += d; buf.pos += d; if (getRemaining() == 0) if (autoFlush) flushBuffer(); else bufferOverflow(); } }
/** * Write a portion of a String. * * @param s String to be written * @param off Offset from which to start reading characters * @param len Number of characters to be written */ public void write(String s, int off, int len) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(s, off, len); return; } int b = off, t = off + len; while (b < t) { int d = min(getRemaining(), t - b); s.getChars(b, b + d, buf.buf, buf.pos); b += d; buf.pos += d; if (getRemaining() == 0) if (autoFlush) flushBuffer(); else bufferOverflow(); } }
/** * Write a single character. */ public void write(int c) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(c); } else { if (getRemaining() == 0) if (autoFlush) flushBuffer(); else bufferOverflow(); buf.buf[buf.pos++] = (char) c; } }
/** * Write a single character. */ public void write(int c) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(c); } else { if (getRemaining() == 0) if (autoFlush) flushBuffer(); else bufferOverflow(); buf.buf[buf.pos++] = (char) c; } }
/** * Write a single character. */ public void write(int c) throws IOException { ensureOpen(); if (bufferSize == 0) { initOut(); out.write(c); } else { if (getRemaining() == 0) if (autoFlush) flushBuffer(); else bufferOverflow(); buf.buf[buf.pos++] = (char) c; } }
int d = min(getRemaining(), t - b); System.arraycopy(cbuf, b, buf.buf, buf.pos, d); b += d; buf.pos += d; if (getRemaining() == 0) if (autoFlush) flushBuffer();
int d = min(getRemaining(), t - b); System.arraycopy(cbuf, b, buf.buf, buf.pos, d); b += d; buf.pos += d; if (getRemaining() == 0) if (autoFlush) flushBuffer();
int d = min(getRemaining(), t - b); System.arraycopy(cbuf, b, buf.buf, buf.pos, d); b += d; buf.pos += d; if (getRemaining() == 0) if (autoFlush) flushBuffer();