@Test public void testClose() throws Exception { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16); final OutputStream out = new ContentLengthOutputStream(outbuffer, outputStream, 15L); out.close(); out.close(); final byte[] tmp = new byte[10]; try { out.write(tmp); Assert.fail("StreamClosedException expected"); } catch (final StreamClosedException expected) { } try { out.write(1); Assert.fail("StreamClosedException expected"); } catch (final StreamClosedException expected) { } }
@Override public void close() throws IOException { if (!this.closed) { this.closed = true; this.buffer.flush(this.outputStream); } }
ContentLengthOutputStream extends OutputStream { @Override public void close() throws IOException { if (!this.closed) { this.closed = true; this.buffer.flush(this.outputStream); } } }
ContentLengthOutputStream extends OutputStream { @Override public void close() throws IOException { if (!this.closed) { this.closed = true; this.buffer.flush(this.outputStream); } } ContentLengthOutputStream(final SessionOutputBuffer buffer, final OutputStream outputStream, final long contentLength); }
ContentLengthOutputStream extends OutputStream { @Override public void close() throws IOException { if (!this.closed) { this.closed = true; this.buffer.flush(this.outputStream); } } ContentLengthOutputStream(final SessionOutputBuffer buffer, final OutputStream outputStream, final long contentLength); @Override void close(); @Override void flush(); @Override void write(final byte[] b, final int off, final int len); @Override void write(final byte[] b); @Override void write(final int b); }
ContentLengthOutputStream extends OutputStream { @Override public void close() throws IOException { if (!this.closed) { this.closed = true; this.buffer.flush(this.outputStream); } } ContentLengthOutputStream(final SessionOutputBuffer buffer, final OutputStream outputStream, final long contentLength); @Override void close(); @Override void flush(); @Override void write(final byte[] b, final int off, final int len); @Override void write(final byte[] b); @Override void write(final int b);  }