Helper for the {@link #log(ConsumerJournalEntry)} method. Writes the
values of a string array
15247
private String writeStringArray(String name, String[] values) {
        StringBuffer buffer = new StringBuffer();
        buffer.append("        ").append(name).append("=[");
        for (int i = 0; i < values.length; i++) {
            buffer.append("'").append(values[i]).append("'");
            if (i < values.length - 1) {
                buffer.append(", ");
            }
        }
        buffer.append("]\n");
        return buffer.toString();
    }
1111417
@Override
	public void writeEntry(String entryName, InputStream inputStream) throws IOException {
		JarArchiveEntry entry = new JarArchiveEntry(entryName);
		writeEntry(entry, new InputStreamEntryWriter(inputStream, true));
	}
1278294
public void log(int iUserID, int iUserLogTypeID, String strMessage)
    {
        try {
            this.addNew();
            this.getField(UserLog.USER_ID).setValue(iUserID);
            this.getField(UserLog.USER_LOG_TYPE_ID).setValue(iUserLogTypeID);
            this.getField(UserLog.MESSAGE).setString(strMessage);
            this.add();
        } catch (DBException ex) {
            ex.printStackTrace();
        }
    }
517484
public void setLog(String log) throws ApplicationException {
	if (StringUtil.isEmpty(log, true)) return;
	this.log = log.trim();
	// throw new ApplicationException("invalid value for attribute log ["+log+"]","valid values are
	// [application, scheduler,console]");
    }
1064146
private void write(JSONObject jsonobject) throws JSONException {

// JSONzip has two encodings for objects: Empty Objects (zipEmptyObject) and
// non-empty objects (zipObject).

        boolean first = true;
        Iterator<String> keys = jsonobject.keys();
        while (keys.hasNext()) {
            if (probe) {
                log();
            }
            Object key = keys.next();
            if (key instanceof String) {
                if (first) {
                    first = false;
                    write(zipObject, 3);
                } else {
                    one();
                }
                writeName((String) key);
                Object value = jsonobject.get((String) key);
                if (value instanceof String) {
                    zero();
                    writeString((String) value);
                } else {
                    one();
                    writeValue(value);
                }
            }
        }
        if (first) {
            write(zipEmptyObject, 3);
        } else {
            zero();
        }
    }
119083
@Override
  public void write(JsonWriterImpl out, AtomicInteger value)
  {
    out.write(value.get());
  }
874600
private void output(final LogEntry logEntry, final Iterable<Writer> writers) {
		if (writingThread == null) {
			for (Writer writer : writers) {
				try {
					writer.write(logEntry);
				} catch (Exception ex) {
					InternalLogger.log(Level.ERROR, ex, "Failed to write log entry '" + logEntry.getMessage() + "'");
				}
			}
		} else {
			for (Writer writer : writers) {
				writingThread.add(writer, logEntry);
			}
		}
	}
812808
public static String write(Date value) {
		if (value==null) return null;
		String text = ThreadLocalDateFormatter.format(value, FULL);
		return text;
	}
775518
public void write(int value, BitWriter bitwriter) throws JSONException {
        this.width = 0;
        write(this.symbols[value], bitwriter);
        tick(value);
        if (JSONzip.probe) {
            JSONzip.logchar(value, this.width);
        }
    }
672981
@CheckReturnValue
    @Override
    public long writeLogTo(long start, OutputStream out) throws IOException {
        return super.writeLogTo(start, new PlainTextConsoleOutputStream(out));
    }
84
private static void writeValue(Object value, JsonWriter writer) throws IOException {
    if (value == null) {
      writer.nullValue();
    } else if (value instanceof Number) {
      writer.value((Number) value);
    } else if (value instanceof Boolean) {
      writer.value((Boolean) value);
    } else if (value instanceof List) {
      listToWriter((List) value, writer);
    } else if (value instanceof Map) {
      mapToWriter((Map) value, writer);
    } else if (value.getClass().isArray()) {
      arrayToWriter(value, writer);
    } else {
      writer.value(String.valueOf(value));
    }
  }
14616
private void writeArray(JsonGenerator jsonGenerator, Object[] array, boolean firstInHierarchy) throws IOException, SQLException {
        if(!firstInHierarchy) {
            jsonGenerator.writeStartArray();
        }
        for(int i = 0; i < array.length; i++) {
            if (array[i] instanceof Integer) {
                jsonGenerator.writeNumber((int) array[i]);
            } else if (array[i] instanceof String) {
                if (array[i].equals("{}")) {
                    jsonGenerator.writeStartObject();
                    jsonGenerator.writeEndObject();
                } else {
                    jsonGenerator.writeString((String) array[i]);
                }
            } else if (array[i] instanceof Double) {
                jsonGenerator.writeNumber((double) array[i]);
            } else if (array[i] instanceof Boolean) {
                jsonGenerator.writeBoolean((boolean) array[i]);
            } else if (array[i] instanceof Object[]) {
                writeArray(jsonGenerator, (Object[]) array[i], false);
            }
        }
        if(!firstInHierarchy) {
            jsonGenerator.writeEndArray();
        }
    }
187758
@Override
  public void write(JsonWriterImpl out, ZonedDateTime value)
  {
    out.write(value.format(_formatter));
  }
1184730
@Override
  public void emitted(Map<String, Object>log)  {
    if (socket == null) return;

    ByteArrayOutputStream messageBuffer = new ByteArrayOutputStream(1024);
    Writer messageWriter = null;
    try {
      messageWriter = new OutputStreamWriter(messageBuffer, "utf-8");
      JsonWriter jsonWriter = new JsonWriter(messageWriter);
      jsonWriter.write(log);
      messageWriter.write("\n");
    } catch (IOException e) {
      throw new InternalSpockError(e);
    } finally {
      IoUtil.closeQuietly(messageWriter);
    }

    ByteArrayOutputStream sizeBuffer = new ByteArrayOutputStream();
    Writer sizeWriter = null;
    try {
      sizeWriter = new OutputStreamWriter(sizeBuffer, "utf-8");
      sizeWriter.write(String.valueOf(messageBuffer.size()));
      sizeWriter.write("\n");
    } catch (IOException e) {
      throw new InternalSpockError(e);
    } finally {
      IoUtil.closeQuietly(sizeWriter);
    }

    try {
      socket.getOutputStream().write(sizeBuffer.toByteArray());
      socket.getOutputStream().write(messageBuffer.toByteArray());
      socket.getOutputStream().flush();
    } catch (Exception e) {
      IoUtil.closeQuietly(socket);
      socket = null;
      throw new ExtensionException("Error sending data to report server. " +
          "Server address: $reportServerAddress Server port: $reportServerPort", e);
    }
  }
204672
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        out.writeInt(_size);
        for (int ii = 0; ii < _size; ii++) {
            out.writeObject(_entries[ii]);
        }
    }
1135067
@Trivial
    public void log(TraceComponent logger) {

        Tr.debug(logger, MessageFormat.format("Annotation [ {0} ]", getAnnotationClassName()));

        // Only log the non-defaulted values.
        for (String valueName : this.values.keySet()) {
            AnnotationValueImpl nextValue = getValue(valueName);

            String valueEnumClassName = nextValue.getEnumClassName();
            Object valueValue = nextValue.getObjectValue();
            // works for all value types, e.g., Object, Enumerated (as String), Class, Array

            if (valueEnumClassName != null) {
                Tr.debug(logger,
                         MessageFormat.format("  Value: Name [ {0} ] Enum Type [ {1} ] Value [ {2} ]",
                                              new Object[] { valueName, valueEnumClassName, valueValue }));
            } else {
                Tr.debug(logger, MessageFormat.format("  Value: Name [ {0} ] Value [ {1} ]",
                                                      new Object[] { valueName, valueValue }));
            }
        }
    }
557255
@Override
    public void writeValue(JsonGenerator g, Object value) throws IOException {
        write(value, g);
    }