Package com.nimbusds.common.json
Class JSONArrayWriter<T extends net.minidev.json.JSONAware>
- java.lang.Object
-
- com.nimbusds.common.json.JSONArrayWriter<T>
-
- All Implemented Interfaces:
Consumer<T>
public class JSONArrayWriter<T extends net.minidev.json.JSONAware> extends Object implements Consumer<T>
JSON array writer for JAX-RS result streaming.
-
-
Constructor Summary
Constructors Constructor Description JSONArrayWriter(Writer writer)
Creates a new JSON array writer.JSONArrayWriter(Writer writer, boolean noDuplicates)
Creates a new JSON array writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(T element)
void
writeEnd()
Writes out the closing ']' of the JSON array and closes the writer.void
writeStart()
Writes out the opening '[' of the JSON array.
-
-
-
Constructor Detail
-
JSONArrayWriter
public JSONArrayWriter(Writer writer)
Creates a new JSON array writer. The output JSON array may contain duplicates.- Parameters:
writer
- Writer for the JSON array. Must not benull
.
-
JSONArrayWriter
public JSONArrayWriter(Writer writer, boolean noDuplicates)
Creates a new JSON array writer.- Parameters:
writer
- Writer for the JSON array. Must not benull
.noDuplicates
-true
to ensure no duplicates are written to the JSON array.
-
-
Method Detail
-
writeStart
public void writeStart()
Writes out the opening '[' of the JSON array.
-
writeEnd
public void writeEnd()
Writes out the closing ']' of the JSON array and closes the writer.
-
-