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[]hexdigitsstatic StringJSON_NL_ARROFARRstatic StringJSON_NL_ARROFMAPstatic StringJSON_NL_ARROFNTVstatic StringJSON_NL_FLATstatic StringJSON_NL_MAPstatic StringJSON_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)StringgetNamedListStyle()default voidunicodeEscape(Appendable out, int ch)default voidwriteArray(String name, Iterator<?> val, boolean raw)default voidwriteArray(String name, List<?> l, boolean raw)default voidwriteArrayCloser()default voidwriteArrayOpener(int size)default voidwriteArraySeparator()default voidwriteBool(String name, String val)if this form of the method is called, val is the Java string form of a booleandefault voidwriteDate(String name, String val)if this form of the method is called, val is the Solr ISO8601 based date formatdefault voidwriteDouble(String name, String val)if this form of the method is called, val is the Java string form of a doubledefault voidwriteFloat(String name, String val)if this form of the method is called, val is the Java string form of a floatdefault voidwriteInt(String name, String val)if this form of the method is called, val is the Java string form of an intdefault voidwriteIterator(IteratorWriter val)Write an array.default voidwriteJsonIter(Iterator<?> val, boolean raw)default voidwriteKey(String fname, boolean needsEscaping)default voidwriteLong(String name, String val)if this form of the method is called, val is the Java string form of a longdefault voidwriteMap(String name, Map<?,?> val, boolean excludeOuter, boolean isFirstVal)default voidwriteMap(MapWriter val)Write a Map.default voidwriteMapCloser()default voidwriteMapOpener(int size)default voidwriteMapSeparator()default voidwriteNamedList(String name, NamedList<?> val)default voidwriteNamedListAsArrArr(String name, NamedList<?> val)default voidwriteNamedListAsArrMap(String name, NamedList<?> val)default voidwriteNamedListAsFlat(String name, NamedList<?> val)default voidwriteNamedListAsMapMangled(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 voidwriteNamedListAsMapWithDups(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 voidwriteNull(String name)default voidwriteStr(String name, String val, boolean needsEscaping)default voidwriteStrRaw(String name, String val)Writes the specified val directly to the backing writer, without wrapping (e.g., in quotes) or escaping of any kind.-
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, writeIterator, writeLong, writeMap, writeNumber, writeVal, 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:
IOExceptionIllegalArgumentException
-
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:
IOExceptionIllegalArgumentException
-
writeArraySeparator
default void writeArraySeparator() throws IOException- Throws:
IOException
-
writeArrayCloser
default void writeArrayCloser() throws IOException- Throws:
IOException
-
writeStrRaw
default void writeStrRaw(String name, String val) throws IOException
Description copied from interface:TextWriterWrites the specified val directly to the backing writer, without wrapping (e.g., in quotes) or escaping of any kind.- Specified by:
writeStrRawin interfaceTextWriter- Throws:
IOException
-
writeStr
default void writeStr(String name, String val, boolean needsEscaping) throws IOException
- Specified by:
writeStrin interfaceTextWriter- Throws:
IOException
-
writeIterator
default void writeIterator(IteratorWriter val) throws IOException
Description copied from interface:PushWriterWrite 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:
writeIteratorin interfacePushWriter- Specified by:
writeIteratorin interfaceTextWriter- Throws:
IOException
-
writeMap
default void writeMap(MapWriter val) throws IOException
Description copied from interface:PushWriterWrite 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:
writeMapin interfacePushWriter- Specified by:
writeMapin interfaceTextWriter- Throws:
IOException
-
writeKey
default void writeKey(String fname, boolean needsEscaping) throws IOException
- Throws:
IOException
-
writeJsonIter
default void writeJsonIter(Iterator<?> val, boolean raw) throws IOException
- Throws:
IOException
-
writeNull
default void writeNull(String name) throws IOException
- Specified by:
writeNullin interfaceTextWriter- Throws:
IOException
-
writeInt
default void writeInt(String name, String val) throws IOException
Description copied from interface:TextWriterif this form of the method is called, val is the Java string form of an int- Specified by:
writeIntin interfaceTextWriter- Throws:
IOException
-
writeLong
default void writeLong(String name, String val) throws IOException
Description copied from interface:TextWriterif this form of the method is called, val is the Java string form of a long- Specified by:
writeLongin interfaceTextWriter- Throws:
IOException
-
writeBool
default void writeBool(String name, String val) throws IOException
Description copied from interface:TextWriterif this form of the method is called, val is the Java string form of a boolean- Specified by:
writeBoolin interfaceTextWriter- Throws:
IOException
-
writeFloat
default void writeFloat(String name, String val) throws IOException
Description copied from interface:TextWriterif this form of the method is called, val is the Java string form of a float- Specified by:
writeFloatin interfaceTextWriter- Throws:
IOException
-
writeDouble
default void writeDouble(String name, String val) throws IOException
Description copied from interface:TextWriterif this form of the method is called, val is the Java string form of a double- Specified by:
writeDoublein interfaceTextWriter- Throws:
IOException
-
writeDate
default void writeDate(String name, String val) throws IOException
Description copied from interface:TextWriterif this form of the method is called, val is the Solr ISO8601 based date format- Specified by:
writeDatein interfaceTextWriter- Throws:
IOException
-
writeMap
default void writeMap(String name, Map<?,?> val, boolean excludeOuter, boolean isFirstVal) throws IOException
- Specified by:
writeMapin interfaceTextWriter- Throws:
IOException
-
writeArray
default void writeArray(String name, List<?> l, boolean raw) throws IOException
- Specified by:
writeArrayin interfaceTextWriter- Throws:
IOException
-
writeArray
default void writeArray(String name, Iterator<?> val, boolean raw) throws IOException
- Specified by:
writeArrayin 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:
writeNamedListin 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
-
-