Class ByteBuffer
Represents a bounded buffer. A dedicated thread can send bytes to this buffer (the producer); while another thread can read bytes from this buffer (the consumer).
Implements
Inherited Members
Namespace: k8s
Assembly: KubernetesClient.dll
Syntax
public class ByteBuffer : IDisposable
Remarks
This is a producer-consumer problem (or bounded-buffer problem), see https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem
Constructors
View SourceByteBuffer()
Initializes a new instance of the ByteBuffer class using the default buffer size and limit.
Declaration
public ByteBuffer()
ByteBuffer(int, int)
Initializes a new instance of the ByteBuffer class.
Declaration
public ByteBuffer(int bufferSize, int maximumSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | bufferSize | The initial buffer size. |
| int | maximumSize | The maximum buffer size. |
Properties
View SourceAvailableReadableBytes
Gets the amount of bytes availble for reading.
Declaration
public int AvailableReadableBytes { get; }
Property Value
| Type | Description |
|---|---|
| int |
AvailableWritableBytes
Gets the amount of bytes available for writing.
Declaration
public int AvailableWritableBytes { get; }
Property Value
| Type | Description |
|---|---|
| int |
MaximumSize
Gets the maximum allowed size of the buffer.
Declaration
public int MaximumSize { get; }
Property Value
| Type | Description |
|---|---|
| int |
ReadWaterMark
Gets the offset from which the next byte will be read. Increased every time a caller reads data.
Declaration
public int ReadWaterMark { get; }
Property Value
| Type | Description |
|---|---|
| int |
Size
Gets the current buffer size.
Declaration
public int Size { get; }
Property Value
| Type | Description |
|---|---|
| int |
WriteWaterMark
Gets the offset to which the next byte will be written. Increased every time a caller writes data.
Declaration
public int WriteWaterMark { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
View SourceDispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Read(byte[], int, int)
Reads bytes from the buffer.
Declaration
public int Read(byte[] data, int offset, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The byte array into which to read the data. |
| int | offset | The offset at which to start writing the bytes. |
| int | count | The amount of bytes to read. |
Returns
| Type | Description |
|---|---|
| int | The total number of bytes read. |
Write(byte[], int, int)
Writes bytes to the buffer.
Declaration
public void Write(byte[] data, int offset, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The source byte array from which to read the bytes. |
| int | offset | The offset of the first byte to copy. |
| int | length | The amount of bytes to copy. |
WriteEnd()
Stops writing data to the buffer, indicating that the end of file has been reached.
Declaration
public void WriteEnd()
Events
View SourceOnResize
The event which is raised when the buffer is resized.
Declaration
public event EventHandler OnResize
Event Type
| Type | Description |
|---|---|
| EventHandler |