docs: @GuardedBy("lock")
      protected void compact() {
          if(read_pos == 0)
              return;
          if(size() == 0) {
              read_pos=write_pos=0;
              return;
          }
          int length=write_pos - read_pos;
          System.arraycopy(buf, read_pos, buf, 0, length);
          write_pos-=read_pos;
          read_pos=0;
          not_full.signalAll();
      }