public final void write(int b) { int newcount = count + 1; ensureCapacity(newcount); buf[count] = (byte) b; count = newcount; }
public final void write(int b) { int newcount = count + 1; ensureCapacity(newcount); buf[count] = (byte) b; count = newcount; }
public final void write(int b) { int newcount = count + 1; ensureCapacity(newcount); buf[count] = (byte) b; count = newcount; }
public final void write(byte b[], int off, int len) { int newcount = count + len; ensureCapacity(newcount); System.arraycopy(b, off, buf, count, len); count = newcount; }
public final void write(byte b[], int off, int len) { int newcount = count + len; ensureCapacity(newcount); System.arraycopy(b, off, buf, count, len); count = newcount; }
public final void write(byte b[], int off, int len) { int newcount = count + len; ensureCapacity(newcount); System.arraycopy(b, off, buf, count, len); count = newcount; }
/** * Reads all the data of the given {@link InputStream} and appends them * into this buffer. * * @throws IOException * if the read operation fails with an {@link IOException}. */ public final void write(InputStream in) throws IOException { while(true) { int cap = buf.length-count; // the remaining buffer space int sz = in.read(buf,count,cap); if(sz<0) return; // hit EOS count += sz; if(cap==sz) ensureCapacity(buf.length*2); // buffer filled up. } }
/** * Reads all the data of the given {@link InputStream} and appends them * into this buffer. * * @throws IOException * if the read operation fails with an {@link IOException}. */ public final void write(InputStream in) throws IOException { while(true) { int cap = buf.length-count; // the remaining buffer space int sz = in.read(buf,count,cap); if(sz<0) return; // hit EOS count += sz; if(cap==sz) ensureCapacity(buf.length*2); // buffer filled up. } }
/** * Reads all the data of the given {@link InputStream} and appends them * into this buffer. * * @throws IOException * if the read operation fails with an {@link IOException}. */ public final void write(InputStream in) throws IOException { while(true) { int cap = buf.length-count; // the remaining buffer space int sz = in.read(buf,count,cap); if(sz<0) return; // hit EOS count += sz; if(cap==sz) ensureCapacity(buf.length*2); // buffer filled up. } }