private static void encodeSingleValue(LittleEndianOutput out, Object value) {
    if (value == EMPTY_REPRESENTATION) {
      out.writeByte(TYPE_EMPTY);
      out.writeLong(0L);
      return;
    }
    if (value instanceof Boolean) {
      Boolean bVal = ((Boolean) value);
      out.writeByte(TYPE_BOOLEAN);
      long longVal = bVal.booleanValue() ? 1L : 0L;
      out.writeLong(longVal);
      return;
    }
    if (value instanceof Double) {
      Double dVal = (Double) value;
      out.writeByte(TYPE_NUMBER);
      out.writeDouble(dVal.doubleValue());
      return;
    }
    if (value instanceof String) {
      String val = (String) value;
      out.writeByte(TYPE_STRING);
      StringUtil.writeUnicodeString(out, val);
      return;
    }
    if (value instanceof ErrorConstant) {
      ErrorConstant ecVal = (ErrorConstant) value;
      out.writeByte(TYPE_ERROR_CODE);
      long longVal = ecVal.getErrorCode();
      out.writeLong(longVal);
      return;
    }

    throw new IllegalStateException("Unexpected value type (" + value.getClass().getName() + "'");
  }
  @Override
  protected void serialize(LittleEndianOutput out) {

    out.writeInt(_grbit1);
    out.writeByte(_grbit2);
    out.writeByte(_citmShow);
    out.writeShort(_isxdiSort);
    out.writeShort(_isxdiShow);

    if (_subtotalName == null) {
      out.writeShort(STRING_NOT_PRESENT_LEN);
    } else {
      out.writeShort(_subtotalName.length());
    }

    out.writeInt(_reserved1);
    out.writeInt(_reserved2);
    if (_subtotalName != null) {
      StringUtil.putUnicodeLE(_subtotalName, out);
    }
  }
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
   out.writeShort(field_1_index_extern_sheet);
   out.writeInt(unused1);
   out.writeInt(unused2);
 }