org.ldaptive.io.JsonWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ldaptive-json Show documentation
Show all versions of ldaptive-json Show documentation
Provides JSON reader and writer
The newest version!
/* See LICENSE for licensing and NOTICE for copyright. */
package org.ldaptive.io;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.json.simple.JSONValue;
import org.ldaptive.LdapAttribute;
import org.ldaptive.LdapEntry;
import org.ldaptive.SearchResult;
/**
* Writes a {@link SearchResult} as JSON to a {@link Writer}.
*
* @author Middleware Services
*/
public class JsonWriter implements SearchResultWriter
{
/** Writer to write to. */
private final Writer jsonWriter;
/**
* Creates a new json writer.
*
* @param writer to write JSON to
*/
public JsonWriter(final Writer writer)
{
jsonWriter = writer;
}
/**
* Writes the supplied search result to the writer.
*
* @param result search result to write
*
* @throws IOException if an error occurs using the writer
*/
@Override
public void write(final SearchResult result)
throws IOException
{
final List © 2015 - 2025 Weber Informatics LLC | Privacy Policy