Package com.unboundid.util

Examples of com.unboundid.util.ByteStringBuffer


     * @throws IOException If there was a problem writing to the underlying output stream.
     */
    @Override
    public void printEntry(final Entry entry) throws IOException {
        if (entry != null) {
            final ByteStringBuffer buffer = new ByteStringBuffer();
            entry.toLDIF(buffer, 77);
            if (!first) {
                ldifOutputStream.write(eol);
            } else {
                first = false;
            }
            ldifOutputStream.write(buffer.toByteArray());
        }
    }
View Full Code Here


     * @throws IOException If there was a problem writing the openng tags.
     */
    public DSMLFormatWriter(final OutputStream outputStream) throws IOException {
        ldifOutputStream = outputStream;
        eol = System.getProperty("line.separator", "\n");
        final ByteStringBuffer buffer = new ByteStringBuffer();
        buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        buffer.append(eol);
        buffer.append("<dsml:dsml xmlns:dsml=\"http://www.dsml.org/DSML\">");
        buffer.append(eol);
        buffer.append("\t<dsml:directory-entries>");
        buffer.append(eol);
        ldifOutputStream.write(buffer.toByteArray());
    }
View Full Code Here

     * @param entry The directory entry.
     * @throws IOException If there was a problem writing to the underlying output stream.
     */
    @Override
    public void printEntry(final Entry entry) throws IOException {
        final ByteStringBuffer buffer = new ByteStringBuffer();
        buffer.append("\t\t<dsml:entry dn=\"");
        buffer.append(entry.getDN());
        buffer.append("\">");
        buffer.append(eol);
        final String[] values = entry.getAttributeValues("objectclass");
        if (values != null) {
            buffer.append("\t\t\t<dsml:objectclass>");
            buffer.append(eol);
            for (final String value : values) {
                buffer.append("\t\t\t\t<dsml:oc-value>");
                buffer.append(value);
                buffer.append("</dsml:oc-value>");
                buffer.append(eol);
            }
            buffer.append("\t\t\t</dsml:objectclass>");
            buffer.append(eol);
        }
        for (final Attribute attribute : entry.getAttributes()) {
            final String name = attribute.getName();
            if (!name.equals("objectclass")) {
                buffer.append("\t\t\t<dsml:attr name=\"");
                buffer.append(name);
                buffer.append("\">");
                buffer.append(eol);
                for (final String value : attribute.getValues()) {
                    buffer.append("\t\t\t\t<dsml:value>");
                    buffer.append(value);
                    buffer.append("</dsml:value>");
                    buffer.append(eol);
                }
                buffer.append("\t\t\t</dsml:attr>");
                buffer.append(eol);
            }
        }
        buffer.append("\t\t</dsml:entry>");
        buffer.append(eol);
        ldifOutputStream.write(buffer.toByteArray());
    }
View Full Code Here

     *
     * @throws IOException If there was a problem writing to the underlying output stream.
     */
    @Override
    public void close() throws IOException {
        final ByteStringBuffer buffer = new ByteStringBuffer();
        buffer.append("\t</dsml:directory-entries>\n");
        buffer.append(eol);
        buffer.append("</dsml:dsml>");
        buffer.append(eol);
        ldifOutputStream.write(buffer.toByteArray());
    }
View Full Code Here

TOP

Related Classes of com.unboundid.util.ByteStringBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.