private void skipToEnd()
    throws IOException
  {
    InputStream is = getInputStream();
    
    if (is == null)
      return;

    if (chunkLength > 0)
      is.skip(chunkLength);

    for (int tag = is.read(); tag >= 0; tag = is.read()) {
      switch (tag) {
      case 'Y':
        server.freeReadLock();
        this.is = is = server.readChannel(channel);
        if (is == null) {
          this.server = null;
          return;
        }
        break;
        
      case 'Q':
        server.freeReadLock();
        this.is = null;
        this.server = null;
        return;

      case -1:
        server.freeReadLock();
        this.is = null;
        this.server = null;
        return;
        
      default:
        int length = (is.read() << 8) + is.read();
        is.skip(length);
        break;
      }
    }
  }