public class JsonWriter extends Object implements SearchResultWriter
SearchResult
as JSON to a Writer
.Modifier and Type | Class and Description |
---|---|
private static class |
JsonWriter.SearchResultSerializer
Serializes a
SearchResult by creating a json array to contain the entries. |
Modifier and Type | Field and Description |
---|---|
private com.google.gson.Gson |
gson
To convert a search result to JSON.
|
private Writer |
jsonWriter
Writer to write to.
|
Constructor and Description |
---|
JsonWriter(Writer writer)
Creates a new json writer.
|
Modifier and Type | Method and Description |
---|---|
void |
write(SearchResult result)
Writes the supplied search result to the writer.
|
private final Writer jsonWriter
private final com.google.gson.Gson gson
public JsonWriter(Writer writer)
writer
- to write JSON topublic void write(SearchResult result) throws IOException
write
in interface SearchResultWriter
result
- search result to writeIOException
- if an error occurs using the writerCopyright © 2003-2019 Virginia Tech. All Rights Reserved.