code: public static <T> Writer<T> writer(Format type, OutputStream out, Map<Class, WriteHandler<?, ?>> customHandlers, WriteHandler<?, ?> defaultWriteHandler, Function<Object,Object> transform) {
          try {
              switch (type) {
                  case MSGPACK:
                      return WriterFactory.getMsgpackInstance(out, customHandlers, defaultWriteHandler, transform);
                  case JSON:
                      return WriterFactory.getJsonInstance(out, customHandlers, defaultWriteHandler, false, transform);
                  case JSON_VERBOSE:
                      return WriterFactory.getJsonInstance(out, customHandlers, defaultWriteHandler, true, transform);
                  default:
                      throw new IllegalArgumentException("Unknown Writer type: " + type.toString());
              }
          } catch (Throwable e) {
              throw new RuntimeException(e);
          }
      }
docs: Creates a writer instance.
  @param type format to write in
  @param out output stream to write to
  @param customHandlers additional WriteHandlers to use in addition
  to or in place of the default WriteHandlers
  @param defaultWriteHandler WriteHandler to use by default
  @param transform a transform function to apply to values before writing
  @return a writer