aQute.lib.json.Encoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biz.aQute.bndlib Show documentation
Show all versions of biz.aQute.bndlib Show documentation
bndlib: A Swiss Army Knife for OSGi
package aQute.lib.json;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.Flushable;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.lang.reflect.Type;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.zip.DeflaterOutputStream;
public class Encoder implements Appendable, Closeable, Flushable {
final JSONCodec codec;
Appendable app;
MessageDigest digest;
boolean writeDefaults;
String encoding = "UTF-8";
boolean deflate;
String tabs = null;
String indent = "";
boolean keepOpen = false;
boolean closed = false;
Encoder(JSONCodec codec) {
this.codec = codec;
}
public Encoder put(Object object) throws Exception {
if (app == null)
to();
codec.encode(this, object, null, new IdentityHashMap