Tabnine Logo
JsonValue.writeTo
Code IndexAdd Tabnine to your IDE (free)

How to use
writeTo
method
in
org.hjson.JsonValue

Best Java code snippets using org.hjson.JsonValue.writeTo (Showing top 10 results out of 315)

origin: org.hjson/hjson

/**
 * Writes the JSON representation of this value to the given writer in its minimal form, without
 * any additional whitespace.
 * <p>
 * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}.
 * </p>
 *
 * @param writer the writer to write this value to
 * @throws IOException if an I/O error occurs in the writer
 */
public void writeTo(Writer writer) throws IOException {
 writeTo(writer, Stringify.PLAIN);
}
origin: hjson/hjson-java

/**
 * Writes the JSON representation of this value to the given writer in its minimal form, without
 * any additional whitespace.
 * <p>
 * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}.
 * </p>
 *
 * @param writer the writer to write this value to
 * @throws IOException if an I/O error occurs in the writer
 */
public void writeTo(Writer writer) throws IOException {
 writeTo(writer, Stringify.PLAIN);
}
origin: org.hjson/hjson

/**
 * Returns the JSON/Hjson string for this value using the given formatting.
 *
 * @param format controls the formatting
 * @return a JSON/Hjson string that represents this value
 */
public String toString(Stringify format) {
 StringWriter writer=new StringWriter();
 try {
  writeTo(writer, format);
 } catch(IOException exception) {
  // StringWriter does not throw IOExceptions
  throw new RuntimeException(exception);
 }
 return writer.toString();
}
origin: hjson/hjson-java

/**
 * Returns the Hjson string for this value using the given formatting.
 *
 * @param options options for the Hjson format
 * @return a Hjson string that represents this value
 */
public String toString(HjsonOptions options) {
 StringWriter writer=new StringWriter();
 try {
  writeTo(writer, options);
 } catch(IOException exception) {
  // StringWriter does not throw IOExceptions
  throw new RuntimeException(exception);
 }
 return writer.toString();
}
/**
origin: org.hjson/hjson

/**
 * Returns the Hjson string for this value using the given formatting.
 *
 * @param options options for the Hjson format
 * @return a Hjson string that represents this value
 */
public String toString(HjsonOptions options) {
 StringWriter writer=new StringWriter();
 try {
  writeTo(writer, options);
 } catch(IOException exception) {
  // StringWriter does not throw IOExceptions
  throw new RuntimeException(exception);
 }
 return writer.toString();
}
/**
origin: hjson/hjson-java

/**
 * Returns the JSON/Hjson string for this value using the given formatting.
 *
 * @param format controls the formatting
 * @return a JSON/Hjson string that represents this value
 */
public String toString(Stringify format) {
 StringWriter writer=new StringWriter();
 try {
  writeTo(writer, format);
 } catch(IOException exception) {
  // StringWriter does not throw IOExceptions
  throw new RuntimeException(exception);
 }
 return writer.toString();
}
origin: org.jasig.cas/cas-server-core-util

@Override
public void toJson(final File out, final T object) {
  try (StringWriter writer = new StringWriter()) {
    this.objectMapper.writer(this.prettyPrinter).writeValue(writer, object);
    JsonValue.readHjson(writer.toString()).writeTo(new BufferedWriter(new FileWriter(out)));
  } catch (final Exception e) {
    throw new IllegalArgumentException(e);
  }
}
origin: org.jasig.cas/cas-server-core-util

@Override
public void toJson(final Writer out, final T object) {
  try (StringWriter writer = new StringWriter()) {
    this.objectMapper.writer(this.prettyPrinter).writeValue(writer, object);
    JsonValue.readHjson(writer.toString()).writeTo(out, Stringify.FORMATTED);
  } catch (final Exception e) {
    throw new IllegalArgumentException(e);
  }
}
origin: org.apereo.cas/cas-server-core-util-api

@Override
@SneakyThrows
public void to(final Writer out, final T object) {
  try (val writer = new StringWriter()) {
    this.objectMapper.writer(this.prettyPrinter).writeValue(writer, object);
    if (isJsonFormat()) {
      val opt = this.prettyPrinter instanceof MinimalPrettyPrinter ? Stringify.PLAIN : Stringify.FORMATTED;
      JsonValue.readHjson(writer.toString()).writeTo(out, opt);
    } else {
      IOUtils.write(writer.toString(), out);
    }
  }
}
origin: org.apereo.cas/cas-server-core-util-api

@Override
@SneakyThrows
public void to(final File out, final T object) {
  try (val writer = new StringWriter()) {
    this.objectMapper.writer(this.prettyPrinter).writeValue(writer, object);
    if (isJsonFormat()) {
      try (val fileWriter = Files.newBufferedWriter(out.toPath(), StandardCharsets.UTF_8)) {
        val opt = this.prettyPrinter instanceof MinimalPrettyPrinter ? Stringify.PLAIN : Stringify.FORMATTED;
        JsonValue.readHjson(writer.toString()).writeTo(fileWriter, opt);
        fileWriter.flush();
      }
    } else {
      FileUtils.write(out, writer.toString(), StandardCharsets.UTF_8);
    }
  }
}
org.hjsonJsonValuewriteTo

Javadoc

Writes the JSON representation of this value to the given writer in its minimal form, without any additional whitespace.

Writing performance can be improved by using a java.io.BufferedWriter.

Popular methods of JsonValue

  • toString
    Returns the JSON/Hjson string for this value using the given formatting.
  • readHjson
    Reads a Hjson value from the given string.
  • asObject
    Returns this JSON value as JsonObject, assuming that this value represents a JSON object. If this is
  • asString
    Returns this JSON value as String, assuming that this value represents a JSON string. If this is not
  • asArray
    Returns this JSON value as JsonArray, assuming that this value represents a JSON array. If this is n
  • asBoolean
    Returns this JSON value as a boolean value, assuming that this value is either true or false. If thi
  • isNumber
    Detects whether this value represents a JSON number.
  • asDouble
    Returns this JSON value as a double value, assuming that this value represents a JSON number. If thi
  • equals
    Indicates whether some other object is "equal to" this one according to the contract specified in Ob
  • hashCode
  • readJSON
    Reads a JSON value from the given string.
  • asFloat
    Returns this JSON value as a float value, assuming that this value represents a JSON number. If this
  • readJSON,
  • asFloat,
  • asInt,
  • asLong,
  • getType,
  • isBoolean,
  • isObject,
  • isPunctuatorChar,
  • isString

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now