PbBlob Class
.NET Standard 2.x
Binary large object. Used to store an unbounded amount of data (for example, generic binary, image, or large text such as a word-processing document).
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public class PbBlob
Constructors
Name | Description |
---|---|
PbBlob() | Initializes an instance of PbBlob. |
PbBlob(uint size) | Initializes an instance of PbBlob. The size can be specified. |
Properties
Name | Return Type | Description |
---|---|---|
Length | uint | Gets the length of PbBlob. |
Size | uint | Gets or sets the size of PbBlob. |
Value | byte[] | Gets or sets the value of PbBlob. |
Methods
Name | Return Type | Description |
---|---|---|
BlobEdit(uint position, object value, Encoding encoding = default) | uint? | Inserts data into a PbBlob object. |
BlobMid(uint position) | PbBlob | Extracts data from a PbBlob object. |
BlobMid(uint position, uint length) | PbBlob | Extracts data from a PbBlob object. |
Create(byte[] bytes) | PbBlob | Converts a byte array to a PbBlob object. |
Create(string text, Encoding encoding = default) | PbBlob | Converts a string to a PbBlob object. |
Equals(object obj) | bool | Determines whether the current PbBlob object has the same data values as the specified object. |
GetByte(uint position, ref byte byteData) | short | Extracts data of type Byte from a PbBlob object. |
GetByteArray() | byte[] | Obtains an array of Byte values stored in a PbBlob object. |
SetByte(uint position, byte byteData) | short | Sets data of type Byte for a PbBlob object. |
ToString() | string | Converts data in a PbBlob to a string value. |
ToString(Encoding encoding) | string | Converts data in a PbBlob to a string value. |
Operators
Name | Description |
---|---|
Addition(PbBlob v1, PbBlob v2) | Adds the data of two PbPlob objects together. |
Equality(PbBlob v1, PbBlob v2) | Determines whether two PbBlob objects have the same data values. |
Implicit(byte[] to PbBlob) | Defines an implicit conversion which converts a byte[] object to a PbBlob object. |
InEquality(PbBlob v1, PbBlob v2) | Determines whether two PbBlob objects are not equal. |
Extension Methods
Name | Return Type | Description |
---|---|---|
Byte() | byte? | Obtains a Byte value stored in a PbBlob. |
Char() | char? | Extracts the first Unicode character of a PbBlob in which the first value is a string or number to a char. |
Char(Encoding encoding) | char? | Extracts the first Unicode character of a PbBlob in which the first value is a string or number to a char. If the blob's value is not text data, Char attempts to interpret the data as characters. |
CharA() | char? | Extracts the first ASCII character of a PbBlob in which the first value is a string or number to a char. |
CharA(Encoding encoding) | char? | Extracts the first ASCII character of a PbBlob in which the first value is a string or number to a char. If the blob's value is not text data, Char attempts to interpret the data as characters. |
Date() | DateTime? | Extracts a DateTime from a blob whose first value is a date or DateTime value. |
DateTime() | DateTime? | Extracts a DateTime value from a blob. |
Dec() | decimal? | Obtains a decimal value stored in a PbBlob. |
Double() | double? | Obtains a double value that is stored in a PbBlob. |
Integer() | short? | Obtains a short value that is stored in a PbBlob. |
Len() | int? | Reports the length of a PbBlob. |
LenA() | int? | Reports the length of a PbBlob. |
Long() | int? | Obtains a long value stored in a PbBlob. |
LongLong() | long? | Obtains a longlong value stored in a PbBlob. |
Real() | float? | Obtains a real value that is stored in a PbBlob. |
String() | string | Converts data in a PbBlob to a string value. If the PbBlob's value is not text data, String attempts to interpret the data as Unicode characters. |
String(Encoding encoding) | string | Converts data in a PbBlob to a string value. If the PbBlob's value is not text data, String attempts to interpret the data as Encoding characters. |
Time() | TimeSpan? | Extracts a TimeSpan value from a PbBlob in which the first value is a time . |
Examples
The following code example creates two PbBlob
objects, adds their values together and returns the result.
using System;
using System.Text;
using PowerScript.Bridge;
namespace Appeon.ApiDoc.PbBlobExamples
{
public class PbBlobExample
{
public void Example()
{
// Creates two PbBlob objects according to byte[] data
PbBlob pbBlob1 = PbBlob.Create(Encoding.ASCII.GetBytes("Hello "));
PbBlob pbBlob2 = PbBlob.Create(Encoding.ASCII.GetBytes("World"));
// Adds the values of two PbBlob objects together
PbBlob pbBlob3 = pbBlob1 + pbBlob2;
Console.WriteLine(Encoding.ASCII.GetString(pbBlob3.Value));
/*This code produces the following output:
Hello World
*/
}
}
}