Package org.apache.solr.common.util
Class SolrJSONWriter
- java.lang.Object
-
- org.apache.solr.common.util.SolrJSONWriter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,PushWriter
,JsonTextWriter
,TextWriter
public class SolrJSONWriter extends Object implements JsonTextWriter
Use this to serialize an object into Json. This only supports standard Objects and not the server-side Objects
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
doIndent
protected int
level
protected String
namedListStyle
-
Fields inherited from interface org.apache.solr.common.util.JsonTextWriter
hexdigits, JSON_NL_ARROFARR, JSON_NL_ARROFMAP, JSON_NL_ARROFNTV, JSON_NL_FLAT, JSON_NL_MAP, JSON_NL_STYLE
-
-
Constructor Summary
Constructors Constructor Description SolrJSONWriter(Writer writer)
SolrJSONWriter(Writer writer, String namedListStyle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
_writeChar(char c)
void
_writeStr(String s)
void
close()
done with all writingint
decLevel()
boolean
doIndent()
String
getNamedListStyle()
Writer
getWriter()
int
incLevel()
int
level()
SolrJSONWriter
setIndent(boolean doIndent)
void
setLevel(int level)
SolrJSONWriter
writeObj(Object o)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.common.util.JsonTextWriter
unicodeEscape, writeArray, writeArray, writeArrayCloser, writeArrayOpener, writeArraySeparator, writeBool, writeDate, writeDouble, writeFloat, writeInt, writeIterator, writeJsonIter, writeKey, writeLong, writeMap, writeMap, writeMapCloser, writeMapOpener, writeMapSeparator, writeNamedList, writeNamedListAsArrArr, writeNamedListAsArrMap, writeNamedListAsFlat, writeNamedListAsMapMangled, writeNamedListAsMapWithDups, writeNull, writeStr
-
Methods inherited from interface org.apache.solr.common.util.TextWriter
indent, indent, writeArray, writeBool, writeBool, writeByteArr, writeDate, writeDouble, writeFloat, writeInt, writeLong, writeNumber, writeVal
-
-
-
-
Field Detail
-
namedListStyle
protected final String namedListStyle
-
level
protected int level
-
doIndent
protected boolean doIndent
-
-
Method Detail
-
writeObj
public SolrJSONWriter writeObj(Object o) throws IOException
- Throws:
IOException
-
close
public void close() throws IOException
done with all writing- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getNamedListStyle
public String getNamedListStyle()
- Specified by:
getNamedListStyle
in interfaceJsonTextWriter
-
_writeChar
public void _writeChar(char c) throws IOException
- Specified by:
_writeChar
in interfaceJsonTextWriter
- Throws:
IOException
-
_writeStr
public void _writeStr(String s) throws IOException
- Specified by:
_writeStr
in interfaceJsonTextWriter
- Throws:
IOException
-
setLevel
public void setLevel(int level)
-
level
public int level()
- Specified by:
level
in interfaceTextWriter
-
incLevel
public int incLevel()
- Specified by:
incLevel
in interfaceTextWriter
-
decLevel
public int decLevel()
- Specified by:
decLevel
in interfaceTextWriter
-
setIndent
public SolrJSONWriter setIndent(boolean doIndent)
- Specified by:
setIndent
in interfaceTextWriter
-
doIndent
public boolean doIndent()
- Specified by:
doIndent
in interfaceTextWriter
-
getWriter
public Writer getWriter()
- Specified by:
getWriter
in interfaceTextWriter
-
-