@Test void writeSingleArrayGrows() { byte[] written = {10, 20}; tested.write(written, 0, written.length); assertThat(tested.buffer).hasSize(2); assertThat(tested.count).isEqualTo(2); assertThat(tested.buffer).containsExactly(written); }
@Override @Synchronized public void write(int byteToWrite) { ensureCapacity(this.count + 1); this.buffer[count] = (byte) byteToWrite; this.count += 1; }
CustomizableByteArrayOutputStream extends OutputStream { @Override @Synchronized public void write(int byteToWrite) { ensureCapacity(this.count + 1); this.buffer[count] = (byte) byteToWrite; this.count += 1; } }
CustomizableByteArrayOutputStream extends OutputStream { @Override @Synchronized public void write(int byteToWrite) { ensureCapacity(this.count + 1); this.buffer[count] = (byte) byteToWrite; this.count += 1; } CustomizableByteArrayOutputStream(int initialCapacity, int maxArraySize, double fillFactorToCopy); }
CustomizableByteArrayOutputStream extends OutputStream { @Override @Synchronized public void write(int byteToWrite) { ensureCapacity(this.count + 1); this.buffer[count] = (byte) byteToWrite; this.count += 1; } CustomizableByteArrayOutputStream(int initialCapacity, int maxArraySize, double fillFactorToCopy); @Override @Synchronized void write(int byteToWrite); @Override @Synchronized void write(byte[] buffer, int off, int len); @Synchronized byte[] getBufferOrCopy(); @Synchronized int size(); @Override void close(); @Synchronized void reset(); }
CustomizableByteArrayOutputStream extends OutputStream { @Override @Synchronized public void write(int byteToWrite) { ensureCapacity(this.count + 1); this.buffer[count] = (byte) byteToWrite; this.count += 1; } CustomizableByteArrayOutputStream(int initialCapacity, int maxArraySize, double fillFactorToCopy); @Override @Synchronized void write(int byteToWrite); @Override @Synchronized void write(byte[] buffer, int off, int len); @Synchronized byte[] getBufferOrCopy(); @Synchronized int size(); @Override void close(); @Synchronized void reset();  }