code: private void writeSimple(Class<?> declaredType, Object value) throws IOException {
          Class<?> realType = value.getClass();
          if (realType == Integer.class) {
              output.writeInt(((Integer) value).intValue());
          } else if (realType == Long.class) {
              output.writeLong(((Long) value).longValue());
          } else if (realType == Short.class) {
              output.writeInt(((Short) value).shortValue());
          } else if (realType == Byte.class) {
              output.writeInt(((Byte) value).byteValue());
          } else if (realType == Float.class) {
              float flt = ((Float) value).floatValue();
              if (Float.isNaN(flt)) {
                  // write as string
                  output.writeNull();
              } else if (Float.isInfinite(flt)) {
                  // write as string
                  output.writeString(Float.toString(flt));
              } else {
                  output.writeFloat(flt);
              }
          } else if (realType == Double.class) {
              double dbl = ((Double) value).doubleValue();
              if (Double.isNaN(dbl)) {
                  // write as string
                  output.writeNull();
              } else if (Double.isInfinite(dbl)) {
                  // write as string
                  output.writeString(Double.toString(dbl));
              } else {
                  output.writeDouble(dbl);
              }
          } else if (realType == Boolean.class) {
              output.writeBoolean(((Boolean) value).booleanValue());
          } else {
              // write as a string
              try {
                  String converted = settings.getConverter().convertToString(realType, value);
                  if (converted == null) {
                      throw new IllegalArgumentException("Unable to write because converter returned a null string: " + value);
                  }
                  output.writeString(converted);
              } catch (RuntimeException ex) {
                  throw new IllegalArgumentException(
                          "Unable to convert type " + declaredType.getName() + " for real type: " + realType.getName(), ex);
              }
          }
      }
docs: write simple type