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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
Thanks, I'm looking forward to testing the new functionality.
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