| /** |
| * Copyright (c) 2013-2015 Angelo ZERR. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation |
| */ |
| package org.eclipse.json.provisonnal.com.eclipsesource.json; |
| |
| import java.io.Writer; |
| |
| |
| /** |
| * Controls the formatting of the JSON output. Use one of the available constants. |
| */ |
| public abstract class WriterConfig { |
| |
| /** |
| * Write JSON in its minimal form, without any additional whitespace. This is the default. |
| */ |
| public static WriterConfig MINIMAL = new WriterConfig() { |
| @Override |
| JsonWriter createWriter( Writer writer ) { |
| return new JsonWriter( writer ); |
| } |
| }; |
| |
| /** |
| * Write JSON in pretty-print, with each value on a separate line and an indentation of two |
| * spaces. |
| */ |
| public static WriterConfig PRETTY_PRINT = new WriterConfig() { |
| @Override |
| JsonWriter createWriter( Writer writer ) { |
| return new PrettyPrinter( writer ); |
| } |
| }; |
| |
| abstract JsonWriter createWriter( Writer writer ); |
| |
| } |