Package org.ldaptive.io
Class JsonWriter
java.lang.Object
org.ldaptive.io.JsonWriter
- All Implemented Interfaces:
SearchResultWriter
Writes a
SearchResponse
as JSON to a Writer
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Serializes aSearchResponse
by creating a json array to contain the entries. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.gson.Gson
To convert a search result to JSON.private final Writer
Writer to write to. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
write
(SearchResponse result) Writes the supplied search result to the writer.
-
Field Details
-
jsonWriter
Writer to write to. -
gson
private final com.google.gson.Gson gsonTo convert a search result to JSON.
-
-
Constructor Details
-
JsonWriter
Creates a new json writer.- Parameters:
writer
- to write JSON to
-
-
Method Details
-
write
Writes the supplied search result to the writer.- Specified by:
write
in interfaceSearchResultWriter
- Parameters:
result
- search result to write- Throws:
IOException
- if an error occurs using the writer
-