Menu

Question regarding LDIFWriter

Aleks
2013-08-29
2013-08-29
  • Aleks

    Aleks - 2013-08-29

    Hello
    I have a system that expects that LDIF files start with the following line:
    version: 1

    How do I get the LDIFWriter to ouput files with that line first?

    Regards,
    Aleks

     
  • Neil Wilson

    Neil Wilson - 2013-08-29

    At present, there isn't any mechanism to accomplish that from within the LDAP SDK. I'll add a method to do that (hopefully later today).

    For now, your best bet is to write that content outside of the LDIF writer. For example, if you create an LDIFWriter with an output stream, you could write "version: 1\n" to the output stream before using that output stream in the LDIFWriter constructor.

    Neil

     
  • Aleks

    Aleks - 2013-08-29

    Thanks, I'm looking forward to testing the new functionality.

     
  • Neil Wilson

    Neil Wilson - 2013-08-29

    I've just committed a change to the LDAP SDK that adds an LDIFWriter.writeVersionHeader method that can be used to write this version header. If you want your LDIF file to have a version header, you should call this method before writing any entries or change records.

    I also updated the LDIFReader.decodeEntry and LDIFReader.decodeChangeRecord methods that take string array arguments so that they now handle a first line that is a version header. The LDIF reader previously handled this header when reading data, but these static decode methods did not support it until this change.

    Neil

     

Log in to post a comment.