C# Класс Lucene.Net.Support.Buffer

Base class for ByteBuffer and LongBuffer (ported from Java)
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
Buffer System
CheckBounds void
CheckIndex int
CheckIndex int
DiscardMark void
NextGetIndex int
NextGetIndex int
NextPutIndex int
NextPutIndex int
Truncate void

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

Метод Описание
Clear ( ) : Buffer

Clears this buffer. The position is set to zero, the limit is set to the capacity, and the mark is discarded.

Invoke this method before using a sequence of channel-read or Put operations to fill this buffer. For example: buf.Clear(); // Prepare buffer for reading in.Read(buf); // Read data

This method does not actually erase the data in the buffer, but it is named as if it did because it will most often be used in situations in which that might as well be the case.

Flip ( ) : Buffer

Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded.

After a sequence of channel-read or Put operations, invoke this method to prepare for a sequence of channel-write or relative Get operations. For example: buf.Put(magic); // Prepend header in.Read(buf); // Read data into rest of buffer buf.Flip(); // Flip buffer out.Write(buf); // Write header + data to channel

This method is often used in conjunction with the ByteBuffer.Compact() method when transferring data from one place to another.

Mark ( ) : Buffer

Sets this buffer's mark at its position.

Reset ( ) : Buffer

Resets this buffer's position to the previously-marked position.

Invoking this method neither changes nor discards the mark's value.

Rewind ( ) : Buffer

Rewinds this buffer. The position is set to zero and the mark is discarded.

Invoke this method before a sequence of channel-write or Get operations, assuming that the limit has already been set appropriately. For example: out.Write(buf); // Write remaining data buf.Rewind(); // Rewind buffer buf.Get(array); // Copy data into array

SetLimit ( int newLimit ) : Buffer

Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit. If the mark is defined and larger than the new limit then it is discarded.

SetPosition ( int newPosition ) : Buffer

Sets this buffer's position. If the mark is defined and larger than the new position then it is discarded.

Приватные методы

Метод Описание
Buffer ( int mark, int pos, int lim, int cap ) : System

Creates a new buffer with the given mark, position, limit, and capacity, after checking invariants.

CheckBounds ( int off, int len, int size ) : void
CheckIndex ( int i ) : int

Checks the given index against the limit, throwing an IndexOutOfRangeException if it is not smaller than the limit or is smaller than zero.

CheckIndex ( int i, int nb ) : int
DiscardMark ( ) : void
NextGetIndex ( ) : int

Checks the current position against the limit, throwing a BufferUnderflowException if it is not smaller than the limit, and then increments the position.

NextGetIndex ( int nb ) : int
NextPutIndex ( ) : int

Checks the current position against the limit, throwing a BufferOverflowException if it is not smaller than the limit, and then increments the position.

NextPutIndex ( int nb ) : int
Truncate ( ) : void

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

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

Clears this buffer. The position is set to zero, the limit is set to the capacity, and the mark is discarded.

Invoke this method before using a sequence of channel-read or Put operations to fill this buffer. For example: buf.Clear(); // Prepare buffer for reading in.Read(buf); // Read data

This method does not actually erase the data in the buffer, but it is named as if it did because it will most often be used in situations in which that might as well be the case.

public Clear ( ) : Buffer
Результат Buffer

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

Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded.

After a sequence of channel-read or Put operations, invoke this method to prepare for a sequence of channel-write or relative Get operations. For example: buf.Put(magic); // Prepend header in.Read(buf); // Read data into rest of buffer buf.Flip(); // Flip buffer out.Write(buf); // Write header + data to channel

This method is often used in conjunction with the ByteBuffer.Compact() method when transferring data from one place to another.

public Flip ( ) : Buffer
Результат Buffer

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

Sets this buffer's mark at its position.
public Mark ( ) : Buffer
Результат Buffer

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

Resets this buffer's position to the previously-marked position.

Invoking this method neither changes nor discards the mark's value.

If the mark has not been set
public Reset ( ) : Buffer
Результат Buffer

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

Rewinds this buffer. The position is set to zero and the mark is discarded.

Invoke this method before a sequence of channel-write or Get operations, assuming that the limit has already been set appropriately. For example: out.Write(buf); // Write remaining data buf.Rewind(); // Rewind buffer buf.Get(array); // Copy data into array

public Rewind ( ) : Buffer
Результат Buffer

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

Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit. If the mark is defined and larger than the new limit then it is discarded.
If the preconditions on do not hold
public SetLimit ( int newLimit ) : Buffer
newLimit int The new limit value; must be non-negative and no larger than this buffer's capacity
Результат Buffer

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

Sets this buffer's position. If the mark is defined and larger than the new position then it is discarded.
If the preconditions on do not hold
public SetPosition ( int newPosition ) : Buffer
newPosition int The new position value; must be non-negative and no larger than the current limit
Результат Buffer