Package org.apache.solr.common.util
Interface JsonTextWriter
-
- All Superinterfaces:
AutoCloseable
,Closeable
,PushWriter
,TextWriter
- All Known Implementing Classes:
SolrJSONWriter
public interface JsonTextWriter extends TextWriter
-
-
Field Summary
Fields Modifier and Type Field Description static char[]
hexdigits
static String
JSON_NL_ARROFARR
static String
JSON_NL_ARROFMAP
static String
JSON_NL_ARROFNTV
static String
JSON_NL_FLAT
static String
JSON_NL_MAP
static String
JSON_NL_STYLE
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
_writeChar(char c)
void
_writeStr(String s)
String
getNamedListStyle()
default void
unicodeEscape(Appendable out, int ch)
default void
writeArray(String name, Iterator val)
default void
writeArray(String name, List l)
default void
writeArrayCloser()
default void
writeArrayOpener(int size)
default void
writeArraySeparator()
default void
writeBool(String name, String val)
if this form of the method is called, val is the Java string form of a booleandefault void
writeDate(String name, String val)
if this form of the method is called, val is the Solr ISO8601 based date formatdefault void
writeDouble(String name, String val)
if this form of the method is called, val is the Java string form of a doubledefault void
writeFloat(String name, String val)
if this form of the method is called, val is the Java string form of a floatdefault void
writeInt(String name, String val)
if this form of the method is called, val is the Java string form of an intdefault void
writeIterator(IteratorWriter val)
Write an array.default void
writeJsonIter(Iterator val)
default void
writeKey(String fname, boolean needsEscaping)
default void
writeLong(String name, String val)
if this form of the method is called, val is the Java string form of a longdefault void
writeMap(String name, Map val, boolean excludeOuter, boolean isFirstVal)
default void
writeMap(MapWriter val)
Write a Map.default void
writeMapCloser()
default void
writeMapOpener(int size)
default void
writeMapSeparator()
default void
writeNamedList(String name, NamedList val)
default void
writeNamedListAsArrArr(String name, NamedList val)
default void
writeNamedListAsArrMap(String name, NamedList val)
default void
writeNamedListAsFlat(String name, NamedList val)
default void
writeNamedListAsMapMangled(String name, NamedList val)
Represents a NamedList directly as a JSON Object (essentially a Map) Map null to "" and name mangle any repeated keys to avoid repeats in the output.default void
writeNamedListAsMapWithDups(String name, NamedList val)
Represents a NamedList directly as a JSON Object (essentially a Map) repeating any keys if they are repeated in the NamedList.default void
writeNull(String name)
default void
writeStr(String name, String val, boolean needsEscaping)
-
Methods inherited from interface org.apache.solr.common.util.TextWriter
decLevel, doIndent, getWriter, incLevel, indent, indent, level, setIndent, writeArray, writeBool, writeBool, writeByteArr, writeDate, writeDouble, writeFloat, writeInt, writeLong, writeNumber, writeVal
-
-
-
-
Field Detail
-
hexdigits
static final char[] hexdigits
-
JSON_NL_MAP
static final String JSON_NL_MAP
- See Also:
- Constant Field Values
-
JSON_NL_FLAT
static final String JSON_NL_FLAT
- See Also:
- Constant Field Values
-
JSON_NL_ARROFARR
static final String JSON_NL_ARROFARR
- See Also:
- Constant Field Values
-
JSON_NL_ARROFMAP
static final String JSON_NL_ARROFMAP
- See Also:
- Constant Field Values
-
JSON_NL_ARROFNTV
static final String JSON_NL_ARROFNTV
- See Also:
- Constant Field Values
-
JSON_NL_STYLE
static final String JSON_NL_STYLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNamedListStyle
String getNamedListStyle()
-
_writeChar
void _writeChar(char c) throws IOException
- Throws:
IOException
-
_writeStr
void _writeStr(String s) throws IOException
- Throws:
IOException
-
writeMapOpener
default void writeMapOpener(int size) throws IOException, IllegalArgumentException
- Throws:
IOException
IllegalArgumentException
-
writeMapSeparator
default void writeMapSeparator() throws IOException
- Throws:
IOException
-
writeMapCloser
default void writeMapCloser() throws IOException
- Throws:
IOException
-
writeArrayOpener
default void writeArrayOpener(int size) throws IOException, IllegalArgumentException
- Throws:
IOException
IllegalArgumentException
-
writeArraySeparator
default void writeArraySeparator() throws IOException
- Throws:
IOException
-
writeArrayCloser
default void writeArrayCloser() throws IOException
- Throws:
IOException
-
writeStr
default void writeStr(String name, String val, boolean needsEscaping) throws IOException
- Specified by:
writeStr
in interfaceTextWriter
- Throws:
IOException
-
writeIterator
default void writeIterator(IteratorWriter val) throws IOException
Description copied from interface:PushWriter
Write an array. The array is opened at the beginning of this method and closed at the end. All array entries must be written before this method returns- Specified by:
writeIterator
in interfacePushWriter
- Specified by:
writeIterator
in interfaceTextWriter
- Throws:
IOException
-
writeMap
default void writeMap(MapWriter val) throws IOException
Description copied from interface:PushWriter
Write a Map. The map is opened in the beginning of the method and closed at the end. All map entries MUST be written before this method returns- Specified by:
writeMap
in interfacePushWriter
- Specified by:
writeMap
in interfaceTextWriter
- Throws:
IOException
-
writeKey
default void writeKey(String fname, boolean needsEscaping) throws IOException
- Throws:
IOException
-
writeJsonIter
default void writeJsonIter(Iterator val) throws IOException
- Throws:
IOException
-
writeNull
default void writeNull(String name) throws IOException
- Specified by:
writeNull
in interfaceTextWriter
- Throws:
IOException
-
writeInt
default void writeInt(String name, String val) throws IOException
Description copied from interface:TextWriter
if this form of the method is called, val is the Java string form of an int- Specified by:
writeInt
in interfaceTextWriter
- Throws:
IOException
-
writeLong
default void writeLong(String name, String val) throws IOException
Description copied from interface:TextWriter
if this form of the method is called, val is the Java string form of a long- Specified by:
writeLong
in interfaceTextWriter
- Throws:
IOException
-
writeBool
default void writeBool(String name, String val) throws IOException
Description copied from interface:TextWriter
if this form of the method is called, val is the Java string form of a boolean- Specified by:
writeBool
in interfaceTextWriter
- Throws:
IOException
-
writeFloat
default void writeFloat(String name, String val) throws IOException
Description copied from interface:TextWriter
if this form of the method is called, val is the Java string form of a float- Specified by:
writeFloat
in interfaceTextWriter
- Throws:
IOException
-
writeDouble
default void writeDouble(String name, String val) throws IOException
Description copied from interface:TextWriter
if this form of the method is called, val is the Java string form of a double- Specified by:
writeDouble
in interfaceTextWriter
- Throws:
IOException
-
writeDate
default void writeDate(String name, String val) throws IOException
Description copied from interface:TextWriter
if this form of the method is called, val is the Solr ISO8601 based date format- Specified by:
writeDate
in interfaceTextWriter
- Throws:
IOException
-
writeMap
default void writeMap(String name, Map val, boolean excludeOuter, boolean isFirstVal) throws IOException
- Specified by:
writeMap
in interfaceTextWriter
- Throws:
IOException
-
writeArray
default void writeArray(String name, List l) throws IOException
- Specified by:
writeArray
in interfaceTextWriter
- Throws:
IOException
-
writeArray
default void writeArray(String name, Iterator val) throws IOException
- Specified by:
writeArray
in interfaceTextWriter
- Throws:
IOException
-
unicodeEscape
default void unicodeEscape(Appendable out, int ch) throws IOException
- Throws:
IOException
-
writeNamedList
default void writeNamedList(String name, NamedList val) throws IOException
- Specified by:
writeNamedList
in interfaceTextWriter
- Throws:
IOException
-
writeNamedListAsMapMangled
default void writeNamedListAsMapMangled(String name, NamedList val) throws IOException
Represents a NamedList directly as a JSON Object (essentially a Map) Map null to "" and name mangle any repeated keys to avoid repeats in the output.- Throws:
IOException
-
writeNamedListAsMapWithDups
default void writeNamedListAsMapWithDups(String name, NamedList val) throws IOException
Represents a NamedList directly as a JSON Object (essentially a Map) repeating any keys if they are repeated in the NamedList. null key is mapped to "".- Throws:
IOException
-
writeNamedListAsArrMap
default void writeNamedListAsArrMap(String name, NamedList val) throws IOException
- Throws:
IOException
-
writeNamedListAsArrArr
default void writeNamedListAsArrArr(String name, NamedList val) throws IOException
- Throws:
IOException
-
writeNamedListAsFlat
default void writeNamedListAsFlat(String name, NamedList val) throws IOException
- Throws:
IOException
-
-