Write a string or null value to the stream
15369
public void writeNullableUTF(String str)
    {
        if (str == null)
            write(NULL_VALUE);
        else
        {
            write(NOT_NULL_VALUE);
            writeUTF(str);
        }
    }
74942
public static void writeStringOpt(DataOutput out, String str) 
      throws IOException{
    if (str == null) {
      WritableUtils.writeVInt(out, NULL_STRING_LENGTH);
      return;
    }
    final int len = str.length();
    TempArrays ta = UTF8.getArrays(len);
    byte[] rawBytes = ta.byteArray;
    char[] charArray = ta.charArray;
    str.getChars(0, len, charArray, 0);

    boolean ascii = true;
    for (int i = 0; i < len; i++) {
      if (charArray[i] > UTF8.MAX_ASCII_CODE) {
        ascii = false;
        break;
      }
      rawBytes[i] = (byte) charArray[i];
    }
    if(ascii) {
      WritableUtils.writeVInt(out, len);
      out.write(rawBytes, 0, len);
    } else {
      writeString(out, str);
    }
  }
61568
protected void writeAttribute(OutputStream outputStream, String name, String value) {
        if (value != null) {
            write(outputStream, " " + name + "=\"" + value + "\"");
        }
    }
1240284
public static void writeValue(OutputStream stream, Object pojo) throws IOException {
        DataModelSerializer.serializeAsStream(pojo, stream);
    }
866340
def write(self, s, level=0, color=None):
        """"""
        if level > self.level:
            return
        if self.timestamps:
            timestamp = time.strftime(u'%H:%M:%S ')
        else:
            timestamp = u''
        with lock:
            if self.context:
                self.stream.write(u'%s%s> ' % (timestamp, self.context))
            elif self.context is None:
                self.stream.write(u'%s%s> ' % (timestamp, get_threadname()))
            self.stream.write(u'%s' % s, color=color)
            try:
                text_type = unicode
            except NameError:
                text_type = str
            self.stream.write(text_type(os.linesep))
            self.stream.flush()
748573
public static void writeUTF(@NotNull final OutputStream stream, @NotNull final String str) throws IOException {
        try (DataOutputStream dataStream = new DataOutputStream(stream)) {
            int len = str.length();
            if (len < SINGLE_UTF_CHUNK_SIZE) {
                dataStream.writeUTF(str);
            } else {
                int startIndex = 0;
                int endIndex;
                do {
                    endIndex = startIndex + SINGLE_UTF_CHUNK_SIZE;
                    if (endIndex > len) {
                        endIndex = len;
                    }
                    dataStream.writeUTF(str.substring(startIndex, endIndex));
                    startIndex += SINGLE_UTF_CHUNK_SIZE;
                } while (endIndex < len);
            }
        }
    }
202278
private void writeAndFlushValue(OutputStream output, ObjectNode value) throws IOException {
		logger.debug("Response: {}", value);

		for (JsonRpcInterceptor interceptor : interceptorList) {
			interceptor.postHandleJson(value);
		}
		mapper.writeValue(new NoCloseOutputStream(output), value);
		output.write('\n');
	}
1261622
async def dump_string(writer, val):
    
    await dump_varint(writer, len(val))
    await writer.awrite(val)
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));
    }
  }
297057
public static <T> void writeNullable(
      @Nullable T value, @NonNull Parcel dest, int flags, @NonNull TypeAdapter<T> adapter) {
    if (value == null) {
      dest.writeInt(0);
    } else {
      dest.writeInt(1);
      adapter.writeToParcel(value, dest, flags);
    }
  }
482590
function toStr(next) {
          var stream = new Writable();
          var str = "";
          stream.write = function(chunk) {
              str += (chunk);
          };
          stream.end = function() {
              next(str);
          };
          return stream;
        }
655305
private static void writeParam(Object v, DataOutput writer) throws IOException {
		if (v instanceof Byte) {
			writer.write(BYTE_ID);
			writer.writeByte(((Byte) v).byteValue());
		} else if (v instanceof Short) {
			writer.write(SHORT_ID);
			writer.writeShort(((Short) v).shortValue());
		} else if (v instanceof Integer) {
			writer.write(INTEGER_ID);
			writer.writeInt(((Integer) v).intValue());
		} else if (v instanceof Character) {
			writer.write(CHAR_ID);
			writer.writeChar(((Character) v).charValue());
		} else if (v instanceof Long) {
			writer.write(LONG_ID);
			writer.writeLong(((Long) v).longValue());
		} else if (v instanceof Float) {
			writer.write(FLOAT_ID);
			writer.writeFloat(((Float) v).floatValue());
		} else if (v instanceof Double) {
			writer.write(DOUBLE_ID);
			writer.writeDouble(((Double) v).doubleValue());
		} else if (v instanceof Date) {
			writer.write(DATE_ID);
			writer.writeLong(((Date) v).getTime());
		} else if (v != null) {
			writer.write(STRING_ID);
			writeString(v.toString(), writer);
		} else {
			writer.write(NULL_ID);
		}
	}
629528
final public void print(String s)
  {
    if (s == null)
      write(_nullChars, 0, _nullChars.length);
    else
      write(s, 0, s.length());
  }
1060071
@Override
    public void write(Void value, TProtocol protocol)
            throws Exception
    {
        Preconditions.checkNotNull(protocol, "protocol is null");
    }
1091180
void write(Writable value) throws IOException {
    byte[] bval;
    int valSize;
    if (value instanceof BytesWritable) {
      BytesWritable val = (BytesWritable) value;
      bval = val.get();
      valSize = val.getSize();
    } 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);
  }
666520
def dump_to_string(self, cnf, **kwargs):
        
        stream = anyconfig.compat.StringIO()
        self.dump_to_stream(cnf, stream, **kwargs)
        return stream.getvalue()
971057
public static void writeString(@Nonnull String str, DataOutputView out) throws IOException {
		checkNotNull(str);
		StringValue.writeString(str, out);
	}