code: public void close() throws IOException {
          byte[] buffer;
          while ( (buffer = buf) != null) {
              if (compareAndSetBuf(buffer, null)) {
                  InputStream input = in;
                  in = null;
                  if (input != null)
                      input.close();
                  return;
              }
              // Else retry in case a new buf was CASed in fill()
          }
      }
docs: Closes this input stream and releases any system resources
  associated with the stream.
  Once the stream has been closed, further read(), available(), reset(),
  or skip() invocations will throw an IOException.
  Closing a previously closed stream has no effect.
  
  @exception  IOException  if an I/O error occurs.