Write query size as json.

<p>default: "querySize":1,

@param sb            StringBuilder to write
@param execInfo      execution info
@param queryInfoList query info list
554970
protected void writeQuerySizeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        sb.append("\"querySize\":");
        sb.append(queryInfoList.size());
        sb.append(", ");
    }
149998
private void toStringList(final StringBuilder sb, final List < ? > list,
            final String title) {
        sb.append(',');
        sb.append(title + ":[");
        boolean first = true;
        for (Object child : list) {
            if (!first) {
                sb.append(",");
            } else {
                first = false;
            }
            sb.append(child.toString());
        }
        sb.append("]");
    }
911486
private static void append(StringBuilder sb, int val, int width) {
    String s = Integer.toString(val);
    for (int i = s.length(); i < width; i++) sb.append('0');
    sb.append(s);
  }
717504
@Override
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);

    out.writeOptionalString(routing);
    out.writeOptionalString(preference);

    if (querySource != null) {
      out.writeBoolean(true);
      out.writeBytesReference(querySource);
    } else {
      out.writeBoolean(false);
    }

    if (types == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeStringArray(types);
    }

    out.writeString(field);
    out.writeVLong(nowInMillis);

    if (ordering == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeVInt(ordering.ordinal());
    }

    if (maxTermsPerShard == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeVInt(maxTermsPerShard);
    }

    if (termsEncoding == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeVInt(termsEncoding.ordinal());
    }

    if (expectedTerms == null) {
      out.writeBoolean(false);
    }
    else {
      out.writeBoolean(true);
      out.writeVLong(expectedTerms);
    }
  }
1300373
public void serialize(@Nonnull Iterable<QueryResult> results, @Nonnull OutputStream out) throws IOException {
		JsonGenerator g = jsonFactory.createGenerator(out, JsonEncoding.UTF8);
		g.writeStartObject();
		g.writeNumberField("timestamp", System.currentTimeMillis() / 1000);
		g.writeNumberField("proto_version", STACKDRIVER_PROTOCOL_VERSION);
		g.writeArrayFieldStart("data");

		for (QueryResult metric : results) {
			g.writeStartObject();
			g.writeStringField("name", metric.getName());
			if (instanceId != null && !instanceId.isEmpty()) {
				g.writeStringField("instance", instanceId);
			}
			g.writeNumberField("collected_at", metric.getEpoch(TimeUnit.SECONDS));
			if (metric.getValue() instanceof Integer) {
				g.writeNumberField("value", (Integer) metric.getValue());
			} else if (metric.getValue() instanceof Long) {
				g.writeNumberField("value", (Long) metric.getValue());
			} else if (metric.getValue() instanceof Float) {
				g.writeNumberField("value", (Float) metric.getValue());
			} else if (metric.getValue() instanceof Double) {
				g.writeNumberField("value", (Double) metric.getValue());
			}
			g.writeEndObject();
		}

		g.writeEndArray();
		g.writeEndObject();
		g.flush();
		g.close();
	}
970159
void setPageSizeAsString(String pageSize) {

        if (CmsStringUtil.isEmpty(pageSize)) {
            return;
        }

        try {
            m_pageSize = Integer.parseInt(pageSize);
        } catch (NumberFormatException e) {
            // intentionally left blank
        }
    }
944817
public static void writeStringFixedSize(final DataOutput out, String s,
      int size) throws IOException {
    byte[] b = toBytes(s);
    if (b.length > size) {
      throw new IOException("Trying to write " + b.length + " bytes (" +
          toStringBinary(b) + ") into a field of length " + size);
    }

    out.writeBytes(s);
    for (int i = 0; i < size - s.length(); ++i) {
      out.writeByte(0);
    }
  }
1284315
public void write(String info) {
		StringBuilder sb = new StringBuilder(40);
		sb.append(type).append(delim);
		sb.append(query - start).append(delim);
		if(retrieve == -1) {
			sb.append(render - query).append(delim);
		} else {
			sb.append(retrieve - query).append(delim);
			sb.append(render - retrieve).append(delim);
		}
		sb.append(info);
		LOGGER.finer(sb.toString());
	}
371117
private void writeIonListContent(IonList val)
    {
        if (val.isNullValue())
        {
            writeByte((byte) (TYPE_LIST | NULL_LENGTH_MASK));
        }
        else
        {
            writeIonSequenceContent(val);
        }
    }
1297062
protected final StringBuilder write(StringBuilder sb,final Object... objects){
		for (Object string : objects)sb.append(string);
		return sb;
	}
586865
public void pad(int width) throws JSONException {
        try {
            this.bitwriter.pad(width);
        } catch (Throwable e) {
            throw new JSONException(e);
        }
    }
520658
@Override
    public void writeExternal(ObjectOutput s) throws IOException {
        if (!removedFromLeakDetection) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc,
                         "Buffer being serialized but removeFromLeakDetection has not been called: " + this);
            }
        }

        if (oByteBuffer.isDirect()) {
            // hard code as local strings to help performance.
            // Strings are used here and and in the readObject routines
            s.writeObject("D");
        } else {
            s.writeObject("ND");
        }
        if (oByteBuffer.order() == java.nio.ByteOrder.BIG_ENDIAN) {
            s.writeObject("B");
        } else {
            s.writeObject("L");
        }

        int startPosition = oByteBuffer.position();
        int startLimit = oByteBuffer.limit();

        // set position to 0 and limit to capacity, so we can serialize
        // the entire buffer
        this.oByteBuffer.position(0);
        this.oByteBuffer.limit(this.oByteBuffer.capacity());

        if (oByteBuffer.hasArray() && oByteBuffer.arrayOffset() == 0) {
            s.writeObject(oByteBuffer.array());
        } else {
            byte[] bytes = new byte[oByteBuffer.limit()];
            this.oByteBuffer.get(bytes);
            s.writeObject(bytes);
        }

        this.oByteBuffer.position(startPosition);
        this.oByteBuffer.limit(startLimit);

        s.writeObject(Integer.toString(startPosition));
        s.writeObject(Integer.toString(startLimit));

        if (this.readOnly) {
            s.writeObject("R");
        } else {
            s.writeObject("RW");
        }
    }
975292
@Override
	public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {
		String gatewayMessage = getGatewayMessage(results);

		// message won't be returned if there are no numeric values in the query results
		if (gatewayMessage != null) {
			logger.info(gatewayMessage);
			doSend(gatewayMessage);
		}
	}
1080446
private void toStringDataDescription(final StringBuilder sb) {
        if (getRedefines() != null) {
            sb.append(',');
            sb.append("redefines:" + getRedefines());
        }
        if (isBlankWhenZero()) {
            sb.append(',');
            sb.append("isBlankWhenZero:" + isBlankWhenZero());
        }
        if (isExternal()) {
            sb.append(',');
            sb.append("isExternal:" + isExternal());
        }
        if (isGlobal()) {
            sb.append(',');
            sb.append("isGlobal:" + isGlobal());
        }
        if (isGroupUsageNational()) {
            sb.append(',');
            sb.append("groupUsageNational:" + isGroupUsageNational());
        }
        if (getMaxOccurs() > 0) {
            if (getMinOccurs() > -1) {
                sb.append(',');
                sb.append("minOccurs:" + getMinOccurs());
            }
            sb.append(',');
            sb.append("maxOccurs:" + getMaxOccurs());
            if (getDependingOn() != null) {
                sb.append(',');
                sb.append("dependingOn:" + getDependingOn());
            }
            if (getIndexes().size() > 0) {
                toStringList(sb, getIndexes(), "indexes");
            }
            if (getAscendingKeys().size() > 0) {
                toStringList(sb, getAscendingKeys(), "ascendingKeys");
            }
            if (getDescendingKeys().size() > 0) {
                toStringList(sb, getDescendingKeys(), "descendingKeys");
            }
        }
        if (isSign()) {
            sb.append(',');
            sb.append("isSign:" + isSign());
            sb.append(',');
            sb.append("isSignLeading:" + isSignLeading());
            sb.append(',');
            sb.append("isSignSeparate:" + isSignSeparate());
        }
        if (isSynchronized()) {
            sb.append(',');
            sb.append("isSynchronized:" + isSynchronized());
        }
        if (getUsage() != null) {
            sb.append(',');
            sb.append("usage:" + getUsage());
        }
        if (getChildren().size() == 0) {
            if (isJustifiedRight()) {
                sb.append(',');
                sb.append("isJustifiedRight:" + isJustifiedRight());
            }
            if (getPicture() != null) {
                sb.append(',');
                sb.append("picture:" + '\"' + getPicture() + '\"');
            }
        }
        if (getValue() != null && getValue().length() > 0) {
            sb.append(',');
            sb.append("value:" + getValue());
        }
        if (getDateFormat() != null) {
            sb.append(',');
            sb.append("dateFormat:" + getDateFormat());
        }
        if (getChildren().size() > 0) {
            toStringList(sb, getChildren(), "children");
        }
    }
137802
public void writeDataMessage(WriteRequest request, DataBuffer buffer) {
    if (buffer == null) {
      write(request);
      return;
    }
    Preconditions.checkState(!request.hasCommand(),
        "write request command should not come with data buffer");
    Preconditions.checkState(buffer.readableBytes() > 0,
        "invalid data size from write request message");
    if (!tryAcquireSemaphore()) {
      return;
    }
    mSerializingExecutor.execute(() -> {
      try {
        writeData(buffer);
      } finally {
        mSemaphore.release();
      }
    });
  }
20462
protected void writeDataSourceNameEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        String name = execInfo.getDataSourceName();
        sb.append("\"name\":\"");
        sb.append(name == null ? "" : escapeSpecialCharacter(name));
        sb.append("\", ");
    }
388136
private synchronized void initQueryBuilder() throws IOException {
        if (queryBuilder == null) {
            indexReader = DirectoryReader.open(indexDirectory);
            indexSearcher = new IndexSearcher(indexReader);
            queryBuilder = new QueryBuilder(writer.getAnalyzer());
        }
    }