C# Class Zetetic.Ldap.LdifWriter

Inheritance: IDisposable
显示文件 Open project: skradel/Zetetic.Ldap Class Usage Examples

Public Methods

Method Description
BeginEntry ( string dn ) : void

Close out an open entry, if any, and write the DN of the new entry to the stream.

Close ( ) : void

Close out the stream; optionally write a summary of execution time and entry count.

Dispose ( ) : void

Just close the output stream (if this LdifWriter owns it) without adding a newline or summary.

EndEntry ( ) : void

Write a blank line to mark the end of the current entry

LdifWriter ( TextWriter tw ) : System

Create an LdifWriter pointed at an existing output stream; the LdifWriter will not close the stream during Dispose.

LdifWriter ( string path ) : System

Create an LdifWriter for ASCII file output. The stream will close upon Disposing this LdifWriter. Call .Close to wrap up the last entry and write a summary.

ModRdn ( string dn, string newRdn, string newSuperior ) : void

Write a 'modrdn' instruction to LDIF. Optionally specify newSuperior to move the object to a new point in the directory tree; or null/blank for RDN change only.

WriteAttr ( string attrName, System.DateTime value ) : void

Write a DateTime to the stream in Generalized UTC format.

WriteAttr ( string attrName, byte value ) : void

Write a binary attribute to the stream in Base64 encoding.

WriteAttr ( string attrName, string value ) : void

Write a string value to the stream, with testing for 7-bit safety. This will switch to Base64 mode as necessary.

WriteChangeSeparator ( ) : void

Emit a single hyphen on a line; useful for generating 'changetype: modify' instructions.

WriteComment ( string comment ) : void

Write a #-notated comment line to the stream.

Protected Methods

Method Description
IsSafeInitChar ( char c ) : bool

any value <= 127 except NUL, LF, CR, SPACE, colon (":", ASCII 58 decimal) and less-than ("<" , ASCII 60 decimal)

IsSafeString ( string value ) : bool

Per http://www.faqs.org/rfcs/rfc2849.html

WriteFolded ( string fmt ) : void

Convenience method that calls String.Format on its arguments.

Method Details

BeginEntry() public method

Close out an open entry, if any, and write the DN of the new entry to the stream.
public BeginEntry ( string dn ) : void
dn string
return void

Close() public method

Close out the stream; optionally write a summary of execution time and entry count.
public Close ( ) : void
return void

Dispose() public method

Just close the output stream (if this LdifWriter owns it) without adding a newline or summary.
public Dispose ( ) : void
return void

EndEntry() public method

Write a blank line to mark the end of the current entry
public EndEntry ( ) : void
return void

IsSafeInitChar() protected static method

any value <= 127 except NUL, LF, CR, SPACE, colon (":", ASCII 58 decimal) and less-than ("<" , ASCII 60 decimal)
protected static IsSafeInitChar ( char c ) : bool
c char
return bool

IsSafeString() protected static method

Per http://www.faqs.org/rfcs/rfc2849.html
protected static IsSafeString ( string value ) : bool
value string
return bool

LdifWriter() public method

Create an LdifWriter pointed at an existing output stream; the LdifWriter will not close the stream during Dispose.
public LdifWriter ( TextWriter tw ) : System
tw System.IO.TextWriter
return System

LdifWriter() public method

Create an LdifWriter for ASCII file output. The stream will close upon Disposing this LdifWriter. Call .Close to wrap up the last entry and write a summary.
public LdifWriter ( string path ) : System
path string
return System

ModRdn() public method

Write a 'modrdn' instruction to LDIF. Optionally specify newSuperior to move the object to a new point in the directory tree; or null/blank for RDN change only.
public ModRdn ( string dn, string newRdn, string newSuperior ) : void
dn string
newRdn string
newSuperior string
return void

WriteAttr() public method

Write a DateTime to the stream in Generalized UTC format.
public WriteAttr ( string attrName, System.DateTime value ) : void
attrName string
value System.DateTime
return void

WriteAttr() public method

Write a binary attribute to the stream in Base64 encoding.
public WriteAttr ( string attrName, byte value ) : void
attrName string
value byte
return void

WriteAttr() public method

Write a string value to the stream, with testing for 7-bit safety. This will switch to Base64 mode as necessary.
public WriteAttr ( string attrName, string value ) : void
attrName string
value string
return void

WriteChangeSeparator() public method

Emit a single hyphen on a line; useful for generating 'changetype: modify' instructions.
public WriteChangeSeparator ( ) : void
return void

WriteComment() public method

Write a #-notated comment line to the stream.
public WriteComment ( string comment ) : void
comment string
return void

WriteFolded() protected method

Convenience method that calls String.Format on its arguments.
protected WriteFolded ( string fmt ) : void
fmt string
return void