writes String value of enum to DataOutput.
@param out Dataoutput stream
@param enumVal enum value
@throws IOException
425198
public static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException {
        Text.writeString(out, enumVal.name());
    }
691288
public void writeTo(Output output, int number, boolean repeated,
            Enum<?> e) throws IOException
    {
        if (0 == (IdStrategy.ENUMS_BY_NAME & strategy.flags))
            output.writeEnum(number, getTag(e), repeated);
        else
            output.writeString(number, getAlias(e), repeated);
    }
493062
private static final void writeVarLengthInt(DataOutput out, int value) throws IOException {
		while (value >= MAX_BIT) {
			out.write(value | MAX_BIT);
			value >>= 7;
		}
		out.write(value);
	}
1327504
public static void writeRawVarint64(OutputStream os, long value) throws IOException {
        while (true) {
            if ((value & ~0x7FL) == 0) {
                os.write((int) value);
                return;
            } else {
                os.write(((int) value & 0x7F) | 0x80);
                value >>>= 7;
            }
        }
    }
893874
public void writeStringLenenc(final String value) {
        if (Strings.isNullOrEmpty(value)) {
            byteBuf.writeByte(0);
            return;
        }
        writeIntLenenc(value.getBytes().length);
        byteBuf.writeBytes(value.getBytes());
    }
607342
public static void writeString(DataOutput out, String s) throws IOException {
    if (s != null) {
      Text text = new Text(s);
      byte[] buffer = text.getBytes();
      int len = text.getLength();
      writeVInt(out, len);
      out.write(buffer, 0, len);
    } else {
      writeVInt(out, -1);
    }
  }
434854
public static void writeMediumInt(IoBuffer out, int value) {
        byte[] bytes = new byte[3];
        bytes[0] = (byte) ((value >>> 16) & 0x000000FF);
        bytes[1] = (byte) ((value >>> 8) & 0x000000FF);
        bytes[2] = (byte) (value & 0x00FF);
        out.put(bytes);
    }
1123286
protected void writeString(OutputStream out, String str) throws IOException {
        if (str == null) {
            writeInt(out, -1);
        } else if (str.isEmpty()) {
            writeInt(out, 0);
        } else {
            byte[] bs = StringSerializer.encode(str);
            writeInt(out, bs.length);
            out.write(bs);
        }
    }
112168
public static void write(Object value, MediaEncoder encoder, Writer out) throws IOException {
		if(encoder==null) {
			write(value, out);
		} else {
			// Otherwise, if A is null, then the result is "".
			// Write nothing
			if(value != null) {
				// Unwrap out to avoid unnecessary validation of known valid output
				while(true) {
					out = unwrap(out);
					if(out instanceof MediaValidator) {
						MediaValidator validator = (MediaValidator)out;
						if(validator.canSkipValidation(encoder.getValidMediaOutputType())) {
							// Can skip validation, write directly to the wrapped output through the encoder
							out = validator.getOut();
						} else {
							break;
						}
					} else {
						break;
					}
				}
				// Write through the given encoder
				if(value instanceof String) {
					// If A is a string, then the result is A.
					encoder.write((String)value, out);
				} else if(value instanceof Writable) {
					Writable writable = (Writable)value;
					if(writable.isFastToString()) {
						encoder.write(writable.toString(), out);
					} else {
						// Avoid intermediate String from Writable
						writable.writeTo(encoder, 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(new MediaWriter(encoder, 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();
					encoder.write(value.toString(), out);
				}
			}
		}
	}
817970
public void write(Writer out)
         throws IOException
    {
        if (codeBase != null)
            attribute("codebase",codeBase);
        
        if (debug)
            paramHolder.add("<param name=\"debug\" value=\"yes\">");
        if (params != null)
            for (Enumeration enm = params.keys(); enm.hasMoreElements();)
            {
                String key = enm.nextElement().toString();
                paramHolder.add("<param name=\"" + key + "\" value=\"" +
                                params.get(key).toString() + "\">");
            }
        super.write(out);
    }
493424
public static void writeVarLongCount(DataOutput out, long val) throws IOException {
		if (val < 0) {
			throw new IOException("Illegal count (must be non-negative): " + val);
		}

		while ((val & ~0x7FL) != 0) {
			out.write(((int) val) | 0x80);
			val >>>= 7;
		}
		out.write((int) val);
	}
1190402
private void writeObject(final ObjectOutputStream out)
		throws IOException
	{
		out.defaultWriteObject();

		out.writeObject(_validAlleles);
		for (EnumGene<?> gene : _genes) {
			out.writeInt(gene.getAlleleIndex());
		}
	}
494416
public void writeInt(OutputStream out, int value) throws IOException {
        writeStartArray(out);
        writeIntInternal(out, value);
        writeEndArray(out);
    }
1348840
public <T extends Enum<T>> void expect(final Enum<T> expect) throws IOException {
    final Bits checkBits = this.read(8);
    final long expectedLong = expect.ordinal();
    if (checkBits.toLong() != expectedLong) {
      final Bits expectedBits = new Bits(expectedLong, 8);
      throw new IOException(String.format("Check for %s failed: %s != %s", expect, checkBits, expectedBits));
    }
  }
1323954
private void write(final int val)
		throws EncodingException
	{

		if (val < 0 || val > 255) {
			throw ErrorFactory.createEncodingException(
					ErrorKeys.DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE,
					"byte value out of range: " + val);
		}

		this.stream.write(val);
	}
1162460
public void encodeSelf(ObjectOutput buf) throws IOException {
    buf.writeByte((byte) type);
    switch (type) {
    case STRING:
      buf.writeUTF((String) value);
      return;
    case LONG:
      buf.writeLong(((Long) value).longValue()); // was NumericValue
      return;
    case DOUBLE:
      buf.writeDouble(((Double) value).doubleValue()); // was NumericValue
      return;
    case INT:
      buf.writeInt(((Integer) value).intValue()); // was NumericValue
      return;
    case FLOAT:
      buf.writeFloat(((Float) value).floatValue()); // was NumericValue
      return;
    case BOOLEAN:
      buf.writeBoolean(((Boolean) value).booleanValue()); // was BooleanValue
      return;
    case OBJECT:
      buf.writeObject(value);
    default:
      throw new IllegalStateException();
    }
  }
1198390
static void writeRawVarint32(ByteBuf out, int value) {
        while (true) {
            if ((value & ~0x7F) == 0) {
                out.writeByte(value);
                return;
            } else {
                out.writeByte((value & 0x7F) | 0x80);
                value >>>= 7;
            }
        }
    }