• API Overview
  • EBICS API
  • FinTS API
  • XS2A API
  • SEPA API
Search Results for

    Class FinByteBuffer

    Dynamically manages a sequence of bytes inside a byte array.

    Inheritance
    System.Object
    FinByteBuffer
    FinSegmentBuffer
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Subsembly.FinTS
    Assembly: Subsembly.FinTS.Core.dll
    Syntax
    public class FinByteBuffer
    Remarks

    A byte buffer can be used to efficiently build a sequence of bytes, similar to the StringBuilder, which is used to build a sequence of characters. The FinByteBuffer provides various methods for appending bytes to its end.

    A FinByteBuffer can also be used to simply hold a reference to a sequence of bytes inside an existing byte array that it does not own. This will be the case if the FinByteBuffer was created through the FinByteBuffer(Byte[], Int32, Int32) constructor. Appending anything to such a FinByteBuffer will always allocate a new byte array and copy all data into the new array. The byte array that was passed to the constructor will never be changed.

    Constructors

    FinByteBuffer()

    Creates a completely empty byte buffer that can be subsequently filled with byte data.

    Declaration
    public FinByteBuffer()

    FinByteBuffer(Byte[])

    Create a byte buffer with an initial content.

    Declaration
    public FinByteBuffer(byte[] vbBytes)
    Parameters
    Type Name Description
    System.Byte[] vbBytes

    Byte array that holds the initial content.

    Remarks

    The FinByteBuffer only holds a reference to the given byte array and does not create a copy, yet. Thus any changes to the content of the provided byte array will be seen by the FinByteBuffer.

    FinByteBuffer(Byte[], Int32, Int32)

    Create a byte buffer with an initial content.

    Declaration
    public FinByteBuffer(byte[] vbBytes, int nOffset, int nLength)
    Parameters
    Type Name Description
    System.Byte[] vbBytes

    Byte array that holds the initial content.

    System.Int32 nOffset

    Starting offset into the byte array where the content begins.

    System.Int32 nLength

    Length of the content.

    Remarks

    The FinByteBuffer only holds a reference to the given byte array and does not create a copy, yet. Thus any changes to the content of the provided byte array will be seen by the FinByteBuffer.

    FinByteBuffer(Int32)

    Creates a completely empty byte buffer with a given initial capacity.

    Declaration
    public FinByteBuffer(int nInitialCapacity)
    Parameters
    Type Name Description
    System.Int32 nInitialCapacity

    The initial capacity that shall be allocated for the new byte buffer. If this is zero, then nothing will be allocated now.

    Properties

    Bytes

    Provides the byte array that is managed by this byte buffer.

    Declaration
    public byte[] Bytes { get; }
    Property Value
    Type Description
    System.Byte[]
    Remarks

    The actual significant data is just a portion of this array. The significant range of this array is defined through the Offset and Length properties.

    Capacity

    The current maximum capacity of this byte buffer that is available without causing a reallocation of the byte array.

    Declaration
    public int Capacity { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks

    Reducing the capacity by setting this property is not possible and any attempt to do so will be ignored. Increasing the capacity will cause a reallocation any copy of the buffer byte array.

    Item[Int32]

    Indexed access to the buffer bytes. The index always zero based, regardless of the actual Offset.

    Declaration
    public byte this[int i] { get; set; }
    Parameters
    Type Name Description
    System.Int32 i
    Property Value
    Type Description
    System.Byte

    Length

    Provides or sets the count of significant bytes in this buffer.

    Declaration
    public int Length { get; set; }
    Property Value
    Type Description
    System.Int32

    The length may be zero but is never negative.

    Remarks

    It is possible to set the length in order to increase or decrease the amount of significant bytes in this buffer. Increasing the length will append zero bytes to the buffer.

    Offset

    Byte offset of the first significant byte in this buffer.

    Declaration
    public int Offset { get; }
    Property Value
    Type Description
    System.Int32

    Reserve

    The amount of additional reserve capacity that allocated whenever the byte array has to be reallocated.

    Declaration
    public int Reserve { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    AppendByte(Byte)

    Declaration
    public void AppendByte(byte b)
    Parameters
    Type Name Description
    System.Byte b

    AppendByteArray(Byte[])

    Appends a sequence of bytes from a byte array to this byte buffer.

    Declaration
    public void AppendByteArray(byte[] vbBytes)
    Parameters
    Type Name Description
    System.Byte[] vbBytes

    Byte array that holds the sequence of bytes to be appended to this byte buffer.

    AppendByteArray(Byte[], Int32, Int32)

    Appends a sequence of bytes from a byte array to this byte buffer.

    Declaration
    public void AppendByteArray(byte[] vbBytes, int nOffset, int nLength)
    Parameters
    Type Name Description
    System.Byte[] vbBytes

    Byte array that holds the sequence of bytes to be appended to this byte buffer.

    System.Int32 nOffset

    Start offset of the sequence of bytes to be appened.

    System.Int32 nLength

    Length of the sequence of bytes to be appened.

    AppendByteBuffer(FinByteBuffer)

    Appends another byte buffer to this byte buffer.

    Declaration
    public void AppendByteBuffer(FinByteBuffer aByteBuffer)
    Parameters
    Type Name Description
    FinByteBuffer aByteBuffer

    The byte buffer to be appended. Must not be null.

    AppendBytes(Byte, Int32)

    Fills with a given byte.

    Declaration
    public void AppendBytes(byte b, int nCount)
    Parameters
    Type Name Description
    System.Byte b
    System.Int32 nCount

    AppendByteStream(Stream, Int32)

    Appends byte data from a byte stream to this byte buffer.

    Declaration
    public int AppendByteStream(Stream aStream, int nLength)
    Parameters
    Type Name Description
    System.IO.Stream aStream

    Stream that provides the byte data to be appended to this byte buffer.

    System.Int32 nLength

    Maximum number of bytes to read from the stream and append to this byte buffer. The byte buffer will be reallocated to have a capacity large enough to hold this amount. Thus it is not at all useful to pass Int32.MaxValue here.

    Returns
    Type Description
    System.Int32

    Returns the actual number of bytes that have been read from the stream and appended to this byte buffer. This may be less than the requested nLength, if the stream was exhausted before nLength bytes could have been read. It may even be zero if the stream was exhausted from the very beginning.

    AppendInteger(Int32, Int32)

    Appends the binary representation of an integer.

    Declaration
    public void AppendInteger(int i, int nLength)
    Parameters
    Type Name Description
    System.Int32 i

    The integer value to be appended.

    System.Int32 nLength

    The number of bytes that shall be appended. This must be zero or a positove value.

    Remarks

    The bytes are always appended in little endian order, regardless of the plattform.

    AppendString(String)

    Appends the low order bytes of a string to this byte buffer.

    Declaration
    public void AppendString(string s)
    Parameters
    Type Name Description
    System.String s

    Clone()

    Create a complete copy of this byte buffer.

    Declaration
    public FinByteBuffer Clone()
    Returns
    Type Description
    FinByteBuffer

    A new FinByteBuffer instance that is a complete copy of this buffer.

    OpenRead()

    Creates a read only stream over the content of this buffer.

    Declaration
    public Stream OpenRead()
    Returns
    Type Description
    System.IO.Stream

    ToArray()

    Creates a new byte array with a copy of the content of this byte buffer.

    Declaration
    public byte[] ToArray()
    Returns
    Type Description
    System.Byte[]

    A newly allocated byte array with a copy of the content of this byte buffer. If this byte buffer is empty, then a zero sized byte array is returned.

    ToString()

    Converts the contents of this buffer to a String without any encoding.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()
    Remarks

    The returned string is created by simply casting each byte of the buffer to a character. This means that the upper byte of the returned Unicode string will always be zero.

    ToString(Encoding)

    Converts the contents of this buffer to a String using the given Encoding.

    Declaration
    public string ToString(Encoding aEncoding)
    Parameters
    Type Name Description
    System.Text.Encoding aEncoding
    Returns
    Type Description
    System.String
    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH