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 int
decLevel()
boolean
doIndent()
Writer
getWriter()
int
incLevel()
default void
indent()
default void
indent(int lev)
int
level()
TextWriter
setIndent(boolean doIndent)
default void
writeArray(String name, Object[] val, boolean raw)
void
writeArray(String name, Iterator<?> val, boolean raw)
default void
writeArray(String name, List<?> l, boolean raw)
default void
writeBool(String name, boolean val)
default void
writeBool(String name, Boolean val)
void
writeBool(String name, String val)
if this form of the method is called, val is the Java string form of a booleandefault void
writeByteArr(String name, byte[] buf, int offset, int len)
void
writeDate(String name, String val)
if this form of the method is called, val is the Solr ISO8601 based date formatdefault void
writeDate(String name, Date val)
default void
writeDouble(String name, double val)
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, float val)
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, int val)
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(String name, IteratorWriter iw, boolean raw)
default void
writeIterator(IteratorWriter iw)
Write an array.default void
writeLong(String name, long val)
void
writeLong(String name, String val)
if this form of the method is called, val is the Java string form of a longvoid
writeMap(String name, Map<?,?> val, boolean excludeOuter, boolean isFirstVal)
default void
writeMap(String name, MapWriter mw)
default void
writeMap(MapWriter mw)
Write a Map.void
writeNamedList(String name, NamedList<?> val)
void
writeNull(String name)
default void
writeNumber(String name, Number val)
void
writeStr(String name, String val, boolean needsEscaping)
default void
writeStrRaw(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 void
writeVal(String name, Object val)
default void
writeVal(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: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
- 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: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
- 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
-
-