C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
buf char[]
cache String
count int

Открытые методы

Метод Описание
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.

Описание методов

Append() публичный Метод

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 ///
Результат void

Append() публичный Метод

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 ///
Результат void

Append() публичный Метод

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 ///
Результат void

Append() публичный Метод

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 ///
Результат void

Append() публичный Метод

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 ///
Результат void

Append() публичный Метод

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 ///
Результат void

Clear() публичный Метод

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
Результат void

EnsureCapacity() публичный Метод

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 ///
Результат void

Length() публичный Метод

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
Результат int

Template() публичный Метод

Constructor for Template. The default Template stores 16 characters before a resize is needed to append extra characters.
public Template ( ) : System
Результат System

Template() публичный Метод

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 ///
Результат System

ToString() публичный Метод

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
Результат String

Описание свойств

buf защищенное свойство

The characters that this buffer has accumulated.
protected char[] buf
Результат char[]

cache защищенное свойство

This is used to quicken toString.
protected String cache
Результат String

count защищенное свойство

This is the number of characters this has stored.
protected int count
Результат int