Write.

@param <T>   the type parameter
@param value the value
@throws IOException the io exception
512818
public <T extends Enum<T>> void write(final Enum<T> value) throws IOException {
    final long ordinal = value.ordinal();
    this.write(new Bits(ordinal, 8));
  }
1240284
public static void writeValue(OutputStream stream, Object pojo) throws IOException {
        DataModelSerializer.serializeAsStream(pojo, stream);
    }
1028247
protected void append(String value) {
        try {
            writer.write(value);
        } catch (Exception e) {
            throw MwsUtl.wrap(e);
        }
    }
1208090
public void writeValue(final int length, final int value)
		throws EncodingException
	{
		if (length > 31) {
			throw ErrorFactory.createEncodingException(
					ErrorKeys.DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE,
					"more than maximum length: " + value);
		}

		for (int i = length - 1; i >= 0; i--) {
			writeBit((value >> i) & 1);
		}
	}
1162715
private void writeField(FieldType field, Object value) throws IOException
   {
      String fieldName = field.name().toLowerCase();
      writeField(fieldName, field.getDataType(), value);
   }
197061
public JsonWriter writeValue(String value) throws IOException {
        if (!willWriteValue) {
            indent();
        }
        writer.write(escape(value));
        willWriteValue = false;
        return this;
    }
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();
    }
672277
void writeExtensionByte(int extensionType, int value) throws IOException {
        output.write(FIX_EXT_1);
        output.write(extensionType);
        output.write(value);
    }
1008269
public static <T> byte[] write(Buffer.Writer<T> writer, T value) {
    Buffer b = Buffer.allocate(writer.sizeInBytes(value));
    try {
      writer.write(value, b);
    } catch (RuntimeException e) {
      byte[] bytes = b.toByteArray();
      int lengthWritten = bytes.length;
      for (int i = 0; i < bytes.length; i++) {
        if (bytes[i] == 0) {
          lengthWritten = i;
          break;
        }
      }

      final byte[] bytesWritten;
      if (lengthWritten == bytes.length) {
        bytesWritten = bytes;
      } else {
        bytesWritten = new byte[lengthWritten];
        System.arraycopy(bytes, 0, bytesWritten, 0, lengthWritten);
      }

      String written = new String(bytesWritten, UTF_8);
      // Don't use value directly in the message, as its toString might be implemented using this
      // method. If that's the case, we'd stack overflow. Instead, emit what we've written so far.
      String message =
        format(
          "Bug found using %s to write %s as json. Wrote %s/%s bytes: %s",
          writer.getClass().getSimpleName(),
          value.getClass().getSimpleName(),
          lengthWritten,
          bytes.length,
          written);
      throw Platform.get().assertionError(message, e);
    }
    return b.toByteArray();
  }
1157037
public void writeBit(int value, int number) throws IOException {
    int localNumber = number;
    while (localNumber > 0) {
      localNumber--;
      bitBuffer |= ((value & 1) << bitCount++);
      if (bitCount == 8) {
        createByte();
      }
    }
  }
979796
public void write(ByteCodeWriter out)
    throws IOException
  {
    out.writeUTF8Const(getName());
    out.writeInt(_value.length);
    out.write(_value, 0, _value.length);
  }
169383
public void setValue(T value)
    {
        try
        {
            lock.writeLock().lock();
            this.value = value;
        }
        finally
        {
            lock.writeLock().unlock();
        }
    }
1112703
public JsonWriter writeValue(Boolean value) throws IOException {
        if (!willWriteValue) {
            indent();
        }
        writer.write(value.toString());
        willWriteValue = false;
        return this;
    }
252154
protected void write(JsonWriter out, T value, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException {
        JsonElement tree = delegate.toJsonTree(value);
        beforeWrite(value, tree);
        elementAdapter.write(out, tree);
    }
1097994
private void writeField(String fieldName, DataType fieldType, Object value) throws IOException
   {
      switch (fieldType)
      {
         case INTEGER:
         {
            writeIntegerField(fieldName, value);
            break;
         }

         case PERCENTAGE:
         case CURRENCY:
         case NUMERIC:
         case UNITS:
         {
            writeDoubleField(fieldName, value);
            break;
         }

         case BOOLEAN:
         {
            writeBooleanField(fieldName, value);
            break;
         }

         case WORK:
         case DURATION:
         {
            writeDurationField(fieldName, value);
            break;
         }

         case DATE:
         {
            writeDateField(fieldName, value);
            break;
         }

         case TIME_UNITS:
         {
            writeTimeUnitsField(fieldName, value);
            break;
         }

         case PRIORITY:
         {
            writePriorityField(fieldName, value);
            break;
         }

         case RELATION_LIST:
         {
            writeRelationList(fieldName, value);
            break;
         }

         case MAP:
         {
            writeMap(fieldName, value);
            break;
         }

         case BINARY:
         {
            // Don't write binary data
            break;
         }

         default:
         {
            writeStringField(fieldName, value);
            break;
         }
      }
   }
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);
        }
    }
1214165
public void writeInt(int value) throws IOException {
    if (4 > buf.length - pos) {
      //not enough space remaining
      byte[] arr = new byte[4];
      arr[0] = (byte) value;
      arr[1] = (byte) (value >> 8);
      arr[2] = (byte) (value >> 16);
      arr[3] = (byte) (value >> 24);
      write(arr, 0, 4);
      return;
    }

    buf[pos] = (byte) value;
    buf[pos + 1] = (byte) (value >> 8);
    buf[pos + 2] = (byte) (value >> 16);
    buf[pos + 3] = (byte) (value >> 24);
    pos += 4;
  }