/** * Close the stream, flushing it first. * This will cause the InputStream associated with this circular buffer * to read its last bytes once it empties the buffer. * Once a stream has been closed, further write() or flush() invocations * will cause an IOException to be thrown. Closing a previously-closed stream, * however, has no effect. * * @throws IOException never. * * @since ostermillerutils 1.00.00 */ @Override public void close() throws IOException { synchronized (CircularByteBuffer.this){ if (!outputStreamClosed && !inputStreamClosed){ flush(); } outputStreamClosed = true; } }