End something.<p>

@param m mode
@param c closing character
@return this
@throws JSONException if unbalanced
191814
private JSONWriter end(char m, char c) throws JSONException {

        if (m_mode != m) {
            throw new JSONException(m == 'o' ? "Misplaced endObject." : "Misplaced endArray.");
        }
        pop(m);
        try {
            m_writer.write(c);
        } catch (IOException e) {
            throw new JSONException(e);
        }
        m_comma = true;
        return this;
    }
1110668
public char next(char c) throws JSONException {
		char n = this.next();
		if (n != c) {
			throw this.syntaxError("Expected '" + c + "' and instead saw '" + n + "'");
		}
		return n;
	}
1358730
public MarkdownDocStream append(char c) {
    if(c == '\n') {
      newline = newline == Newline.NONE ? Newline.NEWLINE : Newline.PAR;
      return this;
    }
    pendingBreak();
    out.append(c);
    return this;
  }
356753
public void onClose(CmmnActivityExecution execution) {
    String id = execution.getId();
    if (execution.isCaseInstanceExecution()) {

      if (execution.isClosed()) {
        throw LOG.alreadyClosedCaseException("close", id);
      }

      if (execution.isActive()) {
        throw LOG.wrongCaseStateException("close", id, "[completed|terminated|suspended]", "active");
      }

    } else {
      throw LOG.notACaseInstanceException("close", id);
    }
  }
1289722
public void end() {
		// if (((ArrayList) this.featureCollection).size() == 0) {
		this.endNewElement();
		// }
		contentHandler.endFeatureCollection(this.featureCollection);
		if (writerContentHandler != null)
			geoJSON = writerContentHandler.endFeatureCollection(geoJSON);
	}
295935
private void _backupChar (final int c)
  {
    if (c != EOI)
      try
      {
        m_aReader.unread (c);
        m_nBackupChars++;
      }
      catch (final IOException ex)
      {
        throw new IllegalStateException ("Failed to unread character " + _getPrintableChar (c));
      }
  }
1177741
public void setNonStrokingColor (final double c, final double m, final double y, final double k) throws IOException
  {
    if (_isOutsideOneInterval (c) ||
        _isOutsideOneInterval (m) ||
        _isOutsideOneInterval (y) ||
        _isOutsideOneInterval (k))
    {
      throw new IllegalArgumentException ("Parameters must be within 0..1, but are (" +
                                          c +
                                          "," +
                                          m +
                                          "," +
                                          y +
                                          "," +
                                          k +
                                          ")");
    }
    writeOperand ((float) c);
    writeOperand ((float) m);
    writeOperand ((float) y);
    writeOperand ((float) k);
    writeOperator ((byte) 'k');
  }
1140962
private void endWithMessage(ServerHttpExchange http, String data) {
      endedWithMessage.set(true);
      boolean jsonp = "true".equals(params.get("cettia-transport-jsonp"));
      if (jsonp) {
        try {
          data = params.get("cettia-transport-callback") + "(" + mapper.writeValueAsString(data) + ");";
        } catch (JsonProcessingException e) {
          throw new RuntimeException(e);
        }
      }
      http.setHeader("content-type", (jsonp ? "text/javascript" : "text/plain") + "; charset=utf-8").end(data);
    }
90171
public char skipTo(char to) throws JSONException {
        char c;
        try {
            int startIndex = this.index;
            int startCharacter = this.character;
            int startLine = this.line;
            reader.mark(Integer.MAX_VALUE);
            do {
                c = next();
                if (c == 0) {
                    reader.reset();
                    this.index = startIndex;
                    this.character = startCharacter;
                    this.line = startLine;
                    return c;
                }
            } while (c != to);
        } catch (IOException exc) {
            throw new JSONException(exc);
        }

        back();
        return c;
    }
491320
public static String escape(char c) {
		final StringBuilder builder = new StringBuilder();
		if (RE_KEYS.contains(c)) {
			builder.append('\\');
		}
		builder.append(c);
		return builder.toString();
	}
58857
public JSONArray switchesToJSON(Collection<Switch> c) {
        JSONArray a = new JSONArray();
        for (Switch s : c) {
            a.add(switchToJSON(s));
        }
        return a;
    }
465795
public String readUntil(char c) throws IOException {
        if (lookaheadChar == UNDEFINED) {
            lookaheadChar = super.read();
        }
        line.clear(); // reuse
        while (lookaheadChar != c && lookaheadChar != END_OF_STREAM) {
            line.append((char) lookaheadChar);
            if (lookaheadChar == '\n') {
                lineCounter++;
            }
            lastChar = lookaheadChar;
            lookaheadChar = super.read();
        }
        return line.toString();
    }
317852
private void push(char c) throws JSONException {

        if (m_top >= MAXDEPTH) {
            throw new JSONException("Nesting too deep.");
        }
        m_stack[m_top] = c;
        m_mode = c;
        m_top += 1;
    }
700581
public void endTo(K to, M msg)
    {
        K key = getCurrentKey();
        if (key.equals(to))
        {
            throw new IllegalArgumentException("current and to are equals");
        }
        if (key != null)
        {
            kill(key);
            doFork(to, msg);
            throw new ThreadStoppedException("suicide");
        }
        else
        {
            throw new IllegalArgumentException("called from wrong thread");
        }
    }
1264948
private JSONWriter append(String string) throws JSONException {
        if (string == null) {
            throw new JSONException("Null pointer");
        }
        if (this.mode == 'o' || this.mode == 'a') {
            try {
                if (this.comma && this.mode == 'a') {
                    this.writer.append(',');
                }
                this.writer.append(string);
            } catch (IOException e) {
            	// Android as of API 25 does not support this exception constructor
            	// however we won't worry about it. If an exception is happening here
            	// it will just throw a "Method not found" exception instead.
                throw new JSONException(e);
            }
            if (this.mode == 'o') {
                this.mode = 'k';
            }
            this.comma = true;
            return this;
        }
        throw new JSONException("Value out of sequence.");
    }
127169
@Override
    public void stop(int mode) {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "stop", new Integer(mode));

        try {
            // Check whether the stop is from COMMS server to stop MP
            // connection. In that case just call closeConnection and return
            if (mode == JsConstants.ME_STOP_COMMS_CONNECTIONS) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc,
                                "Stop request from Comms server for COMMS connections");
                closeConnections(JsConstants.ME_STOP_QUIESCE,
                                 SIMPConstants.MP_VIACOMMS_CONNECTION);
                return;
            }

            if (mode == JsConstants.ME_STOP_COMMS_SSL_CONNECTIONS) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc,
                                "Stop request from Comms server for COMMS SSL connections");
                closeConnections(JsConstants.ME_STOP_QUIESCE,
                                 SIMPConstants.MP_VIACOMMSSSL_CONNECTION);
                return;
            }
        } catch (Exception e) {
            //Absorb the exception and log in trace
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                if (mode == JsConstants.ME_STOP_COMMS_CONNECTIONS)
                    SibTr.debug(tc, "Failure in closing COMMS connections", e);
                else
                    SibTr.debug(tc, "Failure in closing COMMS over SSL connections", e);

            }
            return;
        }

        try {
            // Tell everything we control that MP is stopping now.
            announceMPStopping();

            // Block all new create Connection calls and all calls to
            // connection.close by obtaining the exclusive lock
            _connectionsLockManager.lockExclusive();

            synchronized (_mpStartStopLock) {
                if (_starting) {
                    if (TraceComponent.isAnyTracingEnabled()
                        && tc.isDebugEnabled())
                        SibTr.debug(tc, "Stop waiting until start complete");

                    try {
                        _mpStartStopLock.wait();
                    } catch (InterruptedException e) {
                        // No FFDC code needed
                        if (TraceComponent
                                        .isAnyTracingEnabled()
                            && tc.isDebugEnabled())
                            SibTr.exception(tc, e);
                    }
                }

                if (!_started) {
                    if (TraceComponent.isAnyTracingEnabled()
                        && tc.isEntryEnabled())
                        SibTr.exit(tc, "stop", "Returning as not started.");
                    return;
                }

                _started = false;

                // Stop the mpio to stop processing any more remote messages.
                _mpio.stop();

                // Stop all the threads that have been started
                _stoppableThreadCache.stopAllThreads();

                // Stop expiry first - while stopping we don't want any messages
                // to
                // expire.
                _msgStore.expirerStop();

                _msgStore.deliveryDelayManagerStop();

                // If the destination manager was not found at startup, then
                // this
                // object will be null.
                if (_destinationManager == null) {
                    if (TraceComponent.isAnyTracingEnabled()
                        && tc.isEntryEnabled())
                        SibTr.exit(tc, "stop", "Null DM");
                    return;
                }

                _destinationManager.stop(mode);

                //close all in-process connections .
                closeConnections(mode, SIMPConstants.MP_INPROCESS_CONNECTION);

                // Stop the administrator
                _administrator.stop();

                // Tell MFP that the message store is about to be stopped.
                SchemaStore.messageStoreStoppingNotify(_msgStore);

            } // end sync
        } finally {
            _connectionsLockManager.unlockExclusive();
            // _persistentStore=null is not needed as during reconstitute it is created from messagestore store as a fresh object.
            if (_consumerThreadPool != null) {
                _consumerThreadPool.shutdownNow();
                _consumerThreadPool = null;
            }
            if (_systemThreadPool != null) {
                _systemThreadPool.shutdownNow();
                _systemThreadPool = null;
            }

        }

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "stop");
    }
508280
private JSONWriter append(String s) throws JSONException {

        if (s == null) {
            throw new JSONException("Null pointer");
        }
        if ((m_mode == 'o') || (m_mode == 'a')) {
            try {
                if (m_comma && (m_mode == 'a')) {
                    m_writer.write(',');
                }
                m_writer.write(s);
            } catch (IOException e) {
                throw new JSONException(e);
            }
            if (m_mode == 'o') {
                m_mode = 'k';
            }
            m_comma = true;
            return this;
        }
        throw new JSONException("Value out of sequence.");
    }