Print a value formatted Groovy style to self if it
is a Writer, otherwise to the standard output stream.

@param self  any Object
@param value the value to print
@since 1.0
765575
public static void print(Object self, Object value) {
        // we won't get here if we are a PrintWriter
        if (self instanceof Writer) {
            try {
                ((Writer) self).write(InvokerHelper.toString(value));
            } catch (IOException e) {
                // TODO: Should we have some unified function like PrintWriter.checkError()?
            }
        } else {
            System.out.print(InvokerHelper.toString(value));
        }
    }
232684
public static void write(Object value, Writer out) throws IOException {
		if(out instanceof MediaWriter) {
			// Unwrap media writer and use encoder directly
			MediaWriter mediaWriter = (MediaWriter)out;
			write(
				value,
				mediaWriter.getEncoder(),
				mediaWriter.getOut()
			);
		} else {
			if(value instanceof String) {
				// If A is a string, then the result is A.
				out.write((String)value);
			} else if(value == null) {
				// Otherwise, if A is null, then the result is "".
				// Write nothing
			} else if(value instanceof Writable) {
				Writable writable = (Writable)value;
				if(writable.isFastToString()) {
					out.write(writable.toString());
				} else {
					// Avoid intermediate String from Writable
					writable.writeTo(unwrap(out));
				}
			} else if(value instanceof Node) {
				// Otherwise, if is a DOM node, serialize the output
				try {
					// Can use thread-local or pooled transformers if performance is ever an issue
					TransformerFactory transFactory = TransformerFactory.newInstance();
					Transformer transformer = transFactory.newTransformer();
					transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
					transformer.transform(
						new DOMSource((Node)value),
						new StreamResult(unwrap(out))
					);
				} catch(TransformerException e) {
					throw new IOException(e);
				}
			} else {
				// Otherwise, if A.toString() throws an exception, then raise an error
				// Otherwise, the result is A.toString();
				out.write(value.toString());
			}
		}
	}
697757
private void traceWriterInfo( Object value, JsonWriter writer ) {
        if ( getLogger().isLoggable( Level.INFO ) ) {
            getLogger().log( Level.INFO, "Error on value <" + value + ">. Current output : <" + writer.getOutput() + ">" );
        }
    }
1102088
private void printValueString(final String value) throws IOException {
    if (this.valuesLineCounter > 0 && this.valueSeparator.length() > 0) {
      this.write(this.valueSeparator);
    }

    if (this.prefixValue.length() > 0) {
      this.write(this.prefixValue);
    }

    this.write(value);

    if (this.postfixValue.length() > 0) {
      this.write(this.postfixValue);
    }
    this.valuesLineCounter++;

    if (this.maxValuesPerLine > 0 && this.valuesLineCounter >= this.maxValuesPerLine) {
      for (final Extra e : this.extras) {
        e.onReachedMaxValueNumberForLine(this);
      }
      ensureNewLineMode();
    }
  }
916949
public void writeValue (Object value) {
		if (value == null)
			writeValue(value, null, null);
		else
			writeValue(value, value.getClass(), null);
	}
115287
public static Writer leftShift(Process self, Object value) throws IOException {
        return IOGroovyMethods.leftShift(self.getOutputStream(), value);
    }
896958
@Override
  public void write(JsonWriterImpl out, T value)
  {
    if (value == null) {
      out.writeNull();
    }
    else if (value.getClass() != Object.class) {
      out.writeObjectValue(value);
    }
  }
1318865
void write(Object value) throws IOException {
    if (clientInputSerializer != null) {
      clientInputSerializer.serialize(value);
      return;
    }

    byte[] bval;
    int valSize;
    if (value instanceof BytesWritable) {
      BytesWritable val = (BytesWritable) value;
      bval = val.getBytes();
      valSize = val.getLength();
    } else if (value instanceof Text) {
      Text val = (Text) value;
      bval = val.getBytes();
      valSize = val.getLength();
    } else {
      String sval = value.toString();
      bval = sval.getBytes("UTF-8");
      valSize = bval.length;
    }
    clientOut_.write(bval, 0, valSize);
  }
1063965
public static void println(PrintWriter self, Object value) {
        self.println(InvokerHelper.toString(value));
    }
1162724
public void writeValue (String name, Object value) {
		try {
			writer.name(name);
		} catch (IOException ex) {
			throw new JsonException(ex);
		}
		if (value == null)
			writeValue(value, null, null);
		else
			writeValue(value, value.getClass(), null);
	}
1308427
protected void writeValue( VarValueDef value)
    {
    ConditionWriter conditionWriter = new ConditionWriter( value.getCondition());

    xmlWriter_
      .element( VALUE_TAG)
      .attribute( NAME_ATR, String.valueOf( value.getName()))
      .attributeIf( value.getType() == FAILURE, FAILURE_ATR, "true")
      .attributeIf( value.getType() == ONCE, ONCE_ATR, "true")
      .attributeIf( WHEN_ATR, conditionWriter.getWhenAttribute())
      .attributeIf( PROPERTY_ATR, propertyList( toStream( value.getProperties())))
      .contentIf(
        value.getAnnotationCount() > 0 || conditionWriter.hasWhenElement(),
        () -> { writeAnnotations( value); conditionWriter.writeWhenElement(); })
      .write();
    }
37340
public static void println(Closure self) {
        Object owner = getClosureOwner(self);
        InvokerHelper.invokeMethod(owner, "println", EMPTY_OBJECT_ARRAY);
    }
815692
public JsonWriter value(String value) throws IOException {
        if (value == null) {
            return nullValue();
        }
        beforeValue(false);
        string(value);
        return this;
    }
1314489
public static StringBuilder leftShift(StringBuilder self, Object value) {
        if (value instanceof GString) {
            // Force the conversion of the GString to string now, or appending
            // is going to be extremely expensive, due to calls to GString#charAt,
            // which is going to re-evaluate the GString for each character!
            return self.append(value.toString());
        }
        if (value instanceof CharSequence) {
            return self.append((CharSequence)value);
        }
        return self.append(value);
    }
1112703
public JsonWriter writeValue(Boolean value) throws IOException {
        if (!willWriteValue) {
            indent();
        }
        writer.write(value.toString());
        willWriteValue = false;
        return this;
    }
335078
@SuppressWarnings("unchecked")
    public void writeTo(final Output output, final Object value) throws IOException
    {
        final Schema<Object> schema = strategy.writePojoIdTo(
                output, ID_POJO, (Class<Object>)value.getClass());
        
        if(output instanceof StatefulOutput)
        {
            // update using the derived schema.
            ((StatefulOutput)output).updateLast(schema, this);
        }
        
        // write the rest of the fields of the exact type
        schema.writeTo(output, value);
    }
1180112
public void setFormValue(Object value) {

        if (value == null) {
            value = "";
        }
        if (value instanceof String) {
            String strValue = (String)value;
            if (strValue.length() > 0) {
                checkvalue(strValue);
            }
        }

    }