@Test public void testFlush() throws Exception { final ByteArrayOutputStream proxy = new ByteArrayOutputStream(20); final MemorySegementingOutputStream out = new MemorySegementingOutputStream(proxy, 32768); final byte[] content = RandomUtils.nextBytes(40500); out.write(content, 0, 32800); assertEquals(32768, proxy.toByteArray().length); out.flush(); assertEquals(32800, proxy.toByteArray().length); out.write(content, 32800, 7700); out.close(); assertArrayEquals(content, proxy.toByteArray()); }
@Override public void flush() throws IOException { log.warn(String.format("Flush stream %s", proxy)); this.flush(true); }
MemorySegementingOutputStream extends SegmentingOutputStream { @Override public void flush() throws IOException { log.warn(String.format("Flush stream %s", proxy)); this.flush(true); } }
MemorySegementingOutputStream extends SegmentingOutputStream { @Override public void flush() throws IOException { log.warn(String.format("Flush stream %s", proxy)); this.flush(true); } MemorySegementingOutputStream(final OutputStream proxy, final Integer threshold);  MemorySegementingOutputStream(final OutputStream proxy, final Integer threshold, final ByteArrayOutputStream buffer); }
MemorySegementingOutputStream extends SegmentingOutputStream { @Override public void flush() throws IOException { log.warn(String.format("Flush stream %s", proxy)); this.flush(true); } MemorySegementingOutputStream(final OutputStream proxy, final Integer threshold);  MemorySegementingOutputStream(final OutputStream proxy, final Integer threshold, final ByteArrayOutputStream buffer); @Override void flush(); @Override void close(); }
MemorySegementingOutputStream extends SegmentingOutputStream { @Override public void flush() throws IOException { log.warn(String.format("Flush stream %s", proxy)); this.flush(true); } MemorySegementingOutputStream(final OutputStream proxy, final Integer threshold);  MemorySegementingOutputStream(final OutputStream proxy, final Integer threshold, final ByteArrayOutputStream buffer); @Override void flush(); @Override void close();  }