C# Class SimpleFramework.Xml.Core.Template

This is primarily used to replace the StringBuffer class, as a way for the TemplateEngine to store the data for a specific region within the parse data that constitutes a desired value. The methods are not synchronized so it enables the characters to be taken quicker than the string buffer class.
Afficher le fichier Open project: ngallagher/simplexml Class Usage Examples

Protected Properties

Свойство Type Description
buf char[]
cache String
count int

Méthodes publiques

Méthode Description
Append ( String str ) : void

This will add a String to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large String objects.

Append ( String str, int off, int len ) : void

This will add a String to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large String objects.

Append ( Template text ) : void

This will add a Template to the end of this. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large Template objects.

Append ( Template text, int off, int len ) : void

This will add a Template to the end of this. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large Template objects.

Append ( char c ) : void

This will add a char to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate more characters.

Append ( char c, int off, int len ) : void

This will add a char to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large char arrays.

Clear ( ) : void

This will empty the Template so that the toString paramater will return null. This is used so that the same Template can be recycled for different tokens.

EnsureCapacity ( int min ) : void

This ensure that there is enough space in the buffer to allow for more characters to be added. If the buffer is already larger than min then the buffer will not be expanded at all.

Length ( ) : int

This will return the number of bytes that have been appended to the Template. This will return zero after the clear method has been invoked.

Template ( ) : System

Constructor for Template. The default Template stores 16 characters before a resize is needed to append extra characters.

Template ( int size ) : System

This creates a Template with a specific default size. The buffer will be created the with the length specified. The Template can grow to accomodate a collection of characters larger the the size spacified.

ToString ( ) : String

This will return the characters that have been appended to the Template as a String object. If the String object has been created before then a cached String object will be returned. This method will return null after clear is invoked.

Method Details

Append() public méthode

This will add a String to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large String objects.
public Append ( String str ) : void
str String /// the String to be appended to this ///
Résultat void

Append() public méthode

This will add a String to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large String objects.
public Append ( String str, int off, int len ) : void
str String /// the String to be appended to this ///
off int /// the read offset for the String ///
len int /// the number of characters to append to this ///
Résultat void

Append() public méthode

This will add a Template to the end of this. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large Template objects.
public Append ( Template text ) : void
text Template /// the Template to be appended ///
Résultat void

Append() public méthode

This will add a Template to the end of this. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large Template objects.
public Append ( Template text, int off, int len ) : void
text Template /// the Template to be appended ///
off int /// the read offset for the Template ///
len int /// the number of characters to append to this ///
Résultat void

Append() public méthode

This will add a char to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate more characters.
public Append ( char c ) : void
c char /// the char to be appended ///
Résultat void

Append() public méthode

This will add a char to the end of the buffer. The buffer will not overflow with repeated uses of the append, it uses an ensureCapacity method which will allow the buffer to dynamically grow in size to accomodate large char arrays.
public Append ( char c, int off, int len ) : void
c char /// the char array to be appended to this ///
off int /// the read offset for the array ///
len int /// the number of characters to append to this ///
Résultat void

Clear() public méthode

This will empty the Template so that the toString paramater will return null. This is used so that the same Template can be recycled for different tokens.
public Clear ( ) : void
Résultat void

EnsureCapacity() public méthode

This ensure that there is enough space in the buffer to allow for more characters to be added. If the buffer is already larger than min then the buffer will not be expanded at all.
public EnsureCapacity ( int min ) : void
min int /// the minimum size needed for this buffer ///
Résultat void

Length() public méthode

This will return the number of bytes that have been appended to the Template. This will return zero after the clear method has been invoked.
public Length ( ) : int
Résultat int

Template() public méthode

Constructor for Template. The default Template stores 16 characters before a resize is needed to append extra characters.
public Template ( ) : System
Résultat System

Template() public méthode

This creates a Template with a specific default size. The buffer will be created the with the length specified. The Template can grow to accomodate a collection of characters larger the the size spacified.
public Template ( int size ) : System
size int /// initial size of this Template ///
Résultat System

ToString() public méthode

This will return the characters that have been appended to the Template as a String object. If the String object has been created before then a cached String object will be returned. This method will return null after clear is invoked.
public ToString ( ) : String
Résultat String

Property Details

buf protected_oe property

The characters that this buffer has accumulated.
protected char[] buf
Résultat char[]

cache protected_oe property

This is used to quicken toString.
protected String cache
Résultat String

count protected_oe property

This is the number of characters this has stored.
protected int count
Résultat int