/** * Print every value on a separate line. Use tabs (<code>\t</code>) for indentation. * * @return A PrettyPrint instance for wrapped mode with tab indentation */ public static PrettyPrint singleLine() { return new PrettyPrint(null); }
private WriterConfig getWriterConfig() { switch (printMode) { case REGULAR: return PrettyPrint.singleLine(); case PRETTY: return WriterConfig.PRETTY_PRINT; default: return WriterConfig.MINIMAL; } }
private WriterConfig getWriterConfig() { switch (printMode) { case REGULAR: return PrettyPrint.singleLine(); case PRETTY: return WriterConfig.PRETTY_PRINT; default: return WriterConfig.MINIMAL; } }
/** * Do not break lines, but still insert whitespace between values. * * @return A PrettyPrint instance for single-line mode */ public static PrettyPrint indentWithTabs() { return new PrettyPrint(new char[] {'\t'}); }
public String toString(PrintMode printMode) { StringWriter sw = new StringWriter(); try { switch (printMode) { case REGULAR: Json.parse(toString()).writeTo(sw, PrettyPrint.singleLine()); break; case PRETTY: Json.parse(toString()).writeTo(sw, WriterConfig.PRETTY_PRINT); break; default: return toString(); } } catch (IOException e) {} return sw.toString(); }
/** * Print every value on a separate line. Use the given number of spaces for indentation. * * @param number * the number of spaces to use * @return A PrettyPrint instance for wrapped mode with spaces indentation */ public static PrettyPrint indentWithSpaces(int number) { if (number < 0) { throw new IllegalArgumentException("number is negative"); } char[] chars = new char[number]; Arrays.fill(chars, ' '); return new PrettyPrint(chars); }
public String toString(PrintMode printMode) { StringWriter sw = new StringWriter(); try { switch (printMode) { case REGULAR: Json.parse(toString()).writeTo(sw, PrettyPrint.singleLine()); break; case PRETTY: Json.parse(toString()).writeTo(sw, WriterConfig.PRETTY_PRINT); break; default: return toString(); } } catch (IOException e) {} return sw.toString(); }
/** * Print every value on a separate line. Use tabs (<code>\t</code>) for indentation. * * @return A PrettyPrint instance for wrapped mode with tab indentation */ public static PrettyPrint singleLine() { return new PrettyPrint(null); }
public String toString(PrintMode printMode) { StringWriter sw = new StringWriter(); try { switch (printMode) { case REGULAR: Json.parse(toString()).writeTo(sw, PrettyPrint.singleLine()); break; case PRETTY: Json.parse(toString()).writeTo(sw, WriterConfig.PRETTY_PRINT); break; default: return toString(); } } catch (IOException e) {} return sw.toString(); }
/** * Do not break lines, but still insert whitespace between values. * * @return A PrettyPrint instance for single-line mode */ public static PrettyPrint indentWithTabs() { return new PrettyPrint(new char[] {'\t'}); }
public String toString(PrintMode printMode) { StringWriter sw = new StringWriter(); try { switch (printMode) { case REGULAR: Json.parse(toString()).writeTo(sw, PrettyPrint.singleLine()); break; case PRETTY: Json.parse(toString()).writeTo(sw, WriterConfig.PRETTY_PRINT); break; default: return toString(); } } catch (IOException e) {} return sw.toString(); }
/** * Print every value on a separate line. Use tabs (<code>\t</code>) for indentation. * * @return A PrettyPrint instance for wrapped mode with tab indentation */ public static PrettyPrint singleLine() { return new PrettyPrint(null); }
/** * Do not break lines, but still insert whitespace between values. * * @return A PrettyPrint instance for single-line mode */ public static PrettyPrint indentWithTabs() { return new PrettyPrint(new char[] {'\t'}); }
/** * Print every value on a separate line. Use the given number of spaces for indentation. * * @param number * the number of spaces to use * @return A PrettyPrint instance for wrapped mode with spaces indentation */ public static PrettyPrint indentWithSpaces(int number) { if (number < 0) { throw new IllegalArgumentException("number is negative"); } char[] chars = new char[number]; Arrays.fill(chars, ' '); return new PrettyPrint(chars); }
/** * Print every value on a separate line. Use the given number of spaces for indentation. * * @param number * the number of spaces to use * @return A PrettyPrint instance for wrapped mode with spaces indentation */ public static PrettyPrint indentWithSpaces(int number) { if (number < 0) { throw new IllegalArgumentException("number is negative"); } char[] chars = new char[number]; Arrays.fill(chars, ' '); return new PrettyPrint(chars); }