Class JSONLDAPResultWriter
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.tools.LDAPResultWriter
-
- com.unboundid.ldap.sdk.unboundidds.tools.JSONLDAPResultWriter
-
@ThreadSafety(level=NOT_THREADSAFE) public final class JSONLDAPResultWriter extends LDAPResultWriter
This class provides anLDAPResultWriter
instance that formats results in JSON.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.
-
-
Constructor Summary
Constructors Constructor Description JSONLDAPResultWriter(java.io.OutputStream outputStream)
Creates a new instance of this LDAP result writer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JSONObject
toJSON(Entry entry)
Encodes the provided entry as a JSON object.static void
toJSON(Entry entry, JSONBuffer jsonBuffer)
Appends a JSON object representation of the provided entry to the given buffer.static JSONObject
toJSON(LDAPResult result)
Encodes the provided LDAP result as a JSON object.static void
toJSON(LDAPResult result, JSONBuffer jsonBuffer)
Appends a JSON object representation of the provided entry to the given buffer.static JSONObject
toJSON(SearchResultReference ref)
Encodes the provided search result reference as a JSON object.static void
toJSON(SearchResultReference ref, JSONBuffer jsonBuffer)
Appends a JSON object representation of the provided search result reference to the given buffer.void
writeComment(java.lang.String comment)
Writes the provided comment to the output.void
writeHeader()
Formats and writes a header that describes the way in which the data will be formatted.void
writeResult(LDAPResult result)
Formats and writes the provided LDAP result.void
writeSearchResultEntry(SearchResultEntry entry)
Formats and writes the provided search result entry.void
writeSearchResultReference(SearchResultReference ref)
Formats and writes the provided search result reference.void
writeUnsolicitedNotification(LDAPConnection connection, ExtendedResult notification)
Formats and writes the provided unsolicited notification.-
Methods inherited from class com.unboundid.ldap.sdk.unboundidds.tools.LDAPResultWriter
flush, getPrintStream, print, println, println, updateOutputStream
-
-
-
-
Constructor Detail
-
JSONLDAPResultWriter
public JSONLDAPResultWriter(@NotNull java.io.OutputStream outputStream)
Creates a new instance of this LDAP result writer.- Parameters:
outputStream
- The output stream to which output will be written.
-
-
Method Detail
-
writeComment
public void writeComment(@NotNull java.lang.String comment)
Writes the provided comment to the output.- Specified by:
writeComment
in classLDAPResultWriter
- Parameters:
comment
- The comment to be written. It must not benull
.
-
writeHeader
public void writeHeader()
Formats and writes a header that describes the way in which the data will be formatted. This will be displayed at the beginning of the output (including at the beginning of each file, if output should be spread across multiple files).- Specified by:
writeHeader
in classLDAPResultWriter
-
writeSearchResultEntry
public void writeSearchResultEntry(@NotNull SearchResultEntry entry)
Formats and writes the provided search result entry.- Specified by:
writeSearchResultEntry
in classLDAPResultWriter
- Parameters:
entry
- The search result entry to be processed.
-
toJSON
@NotNull public static JSONObject toJSON(@NotNull Entry entry)
Encodes the provided entry as a JSON object.- Parameters:
entry
- The entry to be encoded as a JSON object. It must not benull
.- Returns:
- The JSON object containing the encoded representation of the entry.
-
toJSON
public static void toJSON(@NotNull Entry entry, @NotNull JSONBuffer jsonBuffer)
Appends a JSON object representation of the provided entry to the given buffer.- Parameters:
entry
- The entry to be encoded as a JSON object. It must not benull
.jsonBuffer
- The JSON buffer to which the encoded representation of the entry is to be appended. It must not benull
.
-
writeSearchResultReference
public void writeSearchResultReference(@NotNull SearchResultReference ref)
Formats and writes the provided search result reference.- Specified by:
writeSearchResultReference
in classLDAPResultWriter
- Parameters:
ref
- The search result reference to be processed.
-
toJSON
@NotNull public static JSONObject toJSON(@NotNull SearchResultReference ref)
Encodes the provided search result reference as a JSON object.- Parameters:
ref
- The search result reference to be encoded as a JSON object. It must not benull
.- Returns:
- The JSON object containing the encoded representation of the search result reference.
-
toJSON
public static void toJSON(@NotNull SearchResultReference ref, @NotNull JSONBuffer jsonBuffer)
Appends a JSON object representation of the provided search result reference to the given buffer.- Parameters:
ref
- The search result reference to be encoded as a JSON object. It must not benull
.jsonBuffer
- The JSON buffer to which the encoded representation of the reference is to be appended. It must not benull
.
-
writeResult
public void writeResult(@NotNull LDAPResult result)
Formats and writes the provided LDAP result.- Specified by:
writeResult
in classLDAPResultWriter
- Parameters:
result
- The LDAP result to be processed. It may or may not be a search result.
-
toJSON
@NotNull public static JSONObject toJSON(@NotNull LDAPResult result)
Encodes the provided LDAP result as a JSON object.- Parameters:
result
- The LDAP result to be encoded as a JSON object. It must not benull
.- Returns:
- The JSON object containing the encoded representation of the LDAP result.
-
toJSON
public static void toJSON(@NotNull LDAPResult result, @NotNull JSONBuffer jsonBuffer)
Appends a JSON object representation of the provided entry to the given buffer.- Parameters:
result
- The LDAP result to be encoded as a JSON object. It must not benull
.jsonBuffer
- The JSON buffer to which the encoded representation of the LDAP result is to be appended. It must not benull
.
-
writeUnsolicitedNotification
public void writeUnsolicitedNotification(@NotNull LDAPConnection connection, @NotNull ExtendedResult notification)
Formats and writes the provided unsolicited notification.- Specified by:
writeUnsolicitedNotification
in classLDAPResultWriter
- Parameters:
connection
- The connection on which the unsolicited notification was received.notification
- The unsolicited notification that was received.
-
-