Package org.apache.solr.common.util
Interface TextWriter
-
- All Superinterfaces:
AutoCloseable,Closeable,PushWriter
- All Known Subinterfaces:
JsonTextWriter
- All Known Implementing Classes:
SolrJSONWriter
public interface TextWriter extends PushWriter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intdecLevel()booleandoIndent()WritergetWriter()intincLevel()default voidindent()default voidindent(int lev)intlevel()TextWritersetIndent(boolean doIndent)default voidwriteArray(String name, Object[] val, boolean raw)voidwriteArray(String name, Iterator<?> val, boolean raw)default voidwriteArray(String name, List<?> l, boolean raw)default voidwriteBool(String name, boolean val)default voidwriteBool(String name, Boolean val)voidwriteBool(String name, String val)if this form of the method is called, val is the Java string form of a booleandefault voidwriteByteArr(String name, byte[] buf, int offset, int len)voidwriteDate(String name, String val)if this form of the method is called, val is the Solr ISO8601 based date formatdefault voidwriteDate(String name, Date val)default voidwriteDouble(String name, double val)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, float val)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, int val)voidwriteInt(String name, String val)if this form of the method is called, val is the Java string form of an intdefault voidwriteIterator(String name, IteratorWriter iw, boolean raw)default voidwriteIterator(IteratorWriter iw)Write an array.default voidwriteLong(String name, long val)voidwriteLong(String name, String val)if this form of the method is called, val is the Java string form of a longvoidwriteMap(String name, Map<?,?> val, boolean excludeOuter, boolean isFirstVal)default voidwriteMap(String name, MapWriter mw)default voidwriteMap(MapWriter mw)Write a Map.voidwriteNamedList(String name, NamedList<?> val)voidwriteNull(String name)default voidwriteNumber(String name, Number val)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.default voidwriteVal(String name, Object val)default voidwriteVal(String name, Object val, boolean raw)
-
-
-
Method Detail
-
writeVal
default void writeVal(String name, Object val) throws IOException
- Throws:
IOException
-
writeVal
default void writeVal(String name, Object val, boolean raw) throws IOException
- Throws:
IOException
-
writeStrRaw
default void writeStrRaw(String name, String val) throws IOException
Writes the specified val directly to the backing writer, without wrapping (e.g., in quotes) or escaping of any kind.- Throws:
IOException
-
writeStr
void writeStr(String name, String val, boolean needsEscaping) throws IOException
- Throws:
IOException
-
writeMap
void writeMap(String name, Map<?,?> val, boolean excludeOuter, boolean isFirstVal) throws IOException
- Throws:
IOException
-
writeArray
void writeArray(String name, Iterator<?> val, boolean raw) throws IOException
- Throws:
IOException
-
writeNull
void writeNull(String name) throws IOException
- Throws:
IOException
-
writeInt
void writeInt(String name, String val) throws IOException
if this form of the method is called, val is the Java string form of an int- Throws:
IOException
-
writeLong
void writeLong(String name, String val) throws IOException
if this form of the method is called, val is the Java string form of a long- Throws:
IOException
-
writeBool
void writeBool(String name, String val) throws IOException
if this form of the method is called, val is the Java string form of a boolean- Throws:
IOException
-
writeFloat
void writeFloat(String name, String val) throws IOException
if this form of the method is called, val is the Java string form of a float- Throws:
IOException
-
writeDouble
void writeDouble(String name, String val) throws IOException
if this form of the method is called, val is the Java string form of a double- Throws:
IOException
-
writeDate
void writeDate(String name, String val) throws IOException
if this form of the method is called, val is the Solr ISO8601 based date format- Throws:
IOException
-
writeNamedList
void writeNamedList(String name, NamedList<?> val) throws IOException
- Throws:
IOException
-
getWriter
Writer getWriter()
-
writeNumber
default void writeNumber(String name, Number val) throws IOException
- Throws:
IOException
-
writeArray
default void writeArray(String name, Object[] val, boolean raw) throws IOException
- Throws:
IOException
-
writeArray
default void writeArray(String name, List<?> l, boolean raw) throws IOException
- Throws:
IOException
-
writeDate
default void writeDate(String name, Date val) throws IOException
- Throws:
IOException
-
writeByteArr
default void writeByteArr(String name, byte[] buf, int offset, int len) throws IOException
- Throws:
IOException
-
writeInt
default void writeInt(String name, int val) throws IOException
- Throws:
IOException
-
writeLong
default void writeLong(String name, long val) throws IOException
- Throws:
IOException
-
writeBool
default void writeBool(String name, boolean val) throws IOException
- Throws:
IOException
-
writeFloat
default void writeFloat(String name, float val) throws IOException
- Throws:
IOException
-
writeDouble
default void writeDouble(String name, double val) throws IOException
- Throws:
IOException
-
writeBool
default void writeBool(String name, Boolean val) throws IOException
- Throws:
IOException
-
writeMap
default void writeMap(MapWriter mw) 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- Throws:
IOException
-
writeMap
default void writeMap(String name, MapWriter mw) throws IOException
- Throws:
IOException
-
writeIterator
default void writeIterator(IteratorWriter iw) 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- Throws:
IOException
-
writeIterator
default void writeIterator(String name, IteratorWriter iw, boolean raw) throws IOException
- Throws:
IOException
-
indent
default void indent() throws IOException- Throws:
IOException
-
incLevel
int incLevel()
-
decLevel
int decLevel()
-
setIndent
TextWriter setIndent(boolean doIndent)
-
level
int level()
-
doIndent
boolean doIndent()
-
indent
default void indent(int lev) throws IOException- Throws:
IOException
-
-