code: public void close() throws IOException {
      // multiple close should return with no errors
      // readThread will close underlying buffer
      readThread.close();
      try {
        readThread.join();
      } catch (InterruptedException e) {
        throw new IOException(e);
      }
    }
docs: Close the input stream. Joins the thread and
  closes the underlying input stream. Can be
  called multiple times.