webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Public Member Functions | Static Public Member Functions | Properties | List of all members
Google.Protobuf.ByteString Class Reference

Immutable array of bytes. More...

Inheritance diagram for Google.Protobuf.ByteString:

Classes

class  Unsafe
 Unsafe operations that can cause IO Failure and/or other catestrophic side-effects.
 

Public Member Functions

byte [] ToByteArray ()
 Converts this ByteString into a byte array. More...
 
string ToBase64 ()
 Converts this ByteString into a standard base64 representation. More...
 
string ToString (Encoding encoding)
 Converts this ByteString into a string by applying the given encoding. More...
 
string ToStringUtf8 ()
 Converts this ByteString into a string by applying the UTF-8 encoding. More...
 
IEnumerator< byte > GetEnumerator ()
 Returns an iterator over the bytes in this ByteString. More...
 
CodedInputStream CreateCodedInput ()
 Creates a CodedInputStream from this ByteString's data. More...
 
override bool Equals (object obj)
 Compares this byte string with another object. More...
 
override int GetHashCode ()
 Returns a hash code for this object. Two equal byte strings will return the same hash code. More...
 
bool Equals (ByteString other)
 Compares this byte string with another. More...
 
void CopyTo (byte[] array, int position)
 Copies the entire byte array to the destination array provided at the offset specified. More...
 
void WriteTo (Stream outputStream)
 Writes the entire byte array to the provided stream More...
 

Static Public Member Functions

static ByteString FromBase64 (string bytes)
 Constructs a ByteString from the Base64 Encoded String. More...
 
static ByteString CopyFrom (params byte[] bytes)
 Constructs a ByteString from the given array. The contents are copied, so further modifications to the array will not be reflected in the returned ByteString. This method can also be invoked in ByteString.CopyFrom(0xaa, 0xbb, ...) form which is primarily useful for testing. More...
 
static ByteString CopyFrom (byte[] bytes, int offset, int count)
 Constructs a ByteString from a portion of a byte array. More...
 
static ByteString CopyFrom (string text, Encoding encoding)
 Creates a new ByteString by encoding the specified text with the given encoding. More...
 
static ByteString CopyFromUtf8 (string text)
 Creates a new ByteString by encoding the specified text in UTF-8. More...
 
static bool operator== (ByteString lhs, ByteString rhs)
 Compares two byte strings for equality. More...
 
static bool operator!= (ByteString lhs, ByteString rhs)
 Compares two byte strings for inequality. More...
 

Properties

static ByteString Empty [get]
 Returns an empty ByteString. More...
 
int Length [get]
 Returns the length of this ByteString in bytes. More...
 
bool IsEmpty [get]
 Returns true if this byte string is empty, false otherwise. More...
 
byte this[int index] [get]
 Retuns the byte at the given index. More...
 

Detailed Description

Immutable array of bytes.

Member Function Documentation

◆ CopyFrom() [1/3]

static ByteString Google.Protobuf.ByteString.CopyFrom ( params byte []  bytes)
inlinestatic

Constructs a ByteString from the given array. The contents are copied, so further modifications to the array will not be reflected in the returned ByteString. This method can also be invoked in ByteString.CopyFrom(0xaa, 0xbb, ...) form which is primarily useful for testing.

◆ CopyFrom() [2/3]

static ByteString Google.Protobuf.ByteString.CopyFrom ( byte []  bytes,
int  offset,
int  count 
)
inlinestatic

Constructs a ByteString from a portion of a byte array.

◆ CopyFrom() [3/3]

static ByteString Google.Protobuf.ByteString.CopyFrom ( string  text,
Encoding  encoding 
)
inlinestatic

Creates a new ByteString by encoding the specified text with the given encoding.

◆ CopyFromUtf8()

static ByteString Google.Protobuf.ByteString.CopyFromUtf8 ( string  text)
inlinestatic

Creates a new ByteString by encoding the specified text in UTF-8.

◆ CopyTo()

void Google.Protobuf.ByteString.CopyTo ( byte []  array,
int  position 
)
inline

Copies the entire byte array to the destination array provided at the offset specified.

◆ CreateCodedInput()

CodedInputStream Google.Protobuf.ByteString.CreateCodedInput ( )
inline

Creates a CodedInputStream from this ByteString's data.

◆ Equals() [1/2]

override bool Google.Protobuf.ByteString.Equals ( object  obj)
inline

Compares this byte string with another object.

Parameters
objThe object to compare this with.
Returns
true if obj refers to an equal ByteString; false otherwise.

◆ Equals() [2/2]

bool Google.Protobuf.ByteString.Equals ( ByteString  other)
inline

Compares this byte string with another.

Parameters
otherThe ByteString to compare this with.
Returns
true if other refers to an equal byte string; false otherwise.

◆ FromBase64()

static ByteString Google.Protobuf.ByteString.FromBase64 ( string  bytes)
inlinestatic

Constructs a ByteString from the Base64 Encoded String.

◆ GetEnumerator()

IEnumerator<byte> Google.Protobuf.ByteString.GetEnumerator ( )
inline

Returns an iterator over the bytes in this ByteString.

Returns
An iterator over the bytes in this object.

◆ GetHashCode()

override int Google.Protobuf.ByteString.GetHashCode ( )
inline

Returns a hash code for this object. Two equal byte strings will return the same hash code.

Returns
A hash code for this object.

◆ operator!=()

static bool Google.Protobuf.ByteString.operator!= ( ByteString  lhs,
ByteString  rhs 
)
inlinestatic

Compares two byte strings for inequality.

Parameters
lhsThe first byte string to compare.
rhsThe second byte string to compare.
Returns
false if the byte strings are equal; true otherwise.

◆ operator==()

static bool Google.Protobuf.ByteString.operator== ( ByteString  lhs,
ByteString  rhs 
)
inlinestatic

Compares two byte strings for equality.

Parameters
lhsThe first byte string to compare.
rhsThe second byte string to compare.
Returns
true if the byte strings are equal; false otherwise.

◆ ToBase64()

string Google.Protobuf.ByteString.ToBase64 ( )
inline

Converts this ByteString into a standard base64 representation.

Returns
A base64 representation of this ByteString.

◆ ToByteArray()

byte [] Google.Protobuf.ByteString.ToByteArray ( )
inline

Converts this ByteString into a byte array.

The data is copied - changes to the returned array will not be reflected in this ByteString.

Returns
A byte array with the same data as this ByteString.

◆ ToString()

string Google.Protobuf.ByteString.ToString ( Encoding  encoding)
inline

Converts this ByteString into a string by applying the given encoding.

This method should only be used to convert binary data which was the result of encoding text with the given encoding.

Parameters
encodingThe encoding to use to decode the binary data into text.
Returns
The result of decoding the binary data with the given decoding.

◆ ToStringUtf8()

string Google.Protobuf.ByteString.ToStringUtf8 ( )
inline

Converts this ByteString into a string by applying the UTF-8 encoding.

This method should only be used to convert binary data which was the result of encoding text with UTF-8.

Returns
The result of decoding the binary data with the given decoding.

◆ WriteTo()

void Google.Protobuf.ByteString.WriteTo ( Stream  outputStream)
inline

Writes the entire byte array to the provided stream

Property Documentation

◆ Empty

ByteString Google.Protobuf.ByteString.Empty
staticget

Returns an empty ByteString.

◆ IsEmpty

bool Google.Protobuf.ByteString.IsEmpty
get

Returns true if this byte string is empty, false otherwise.

◆ Length

int Google.Protobuf.ByteString.Length
get

Returns the length of this ByteString in bytes.

◆ this[int index]

byte Google.Protobuf.ByteString.this[int index]
get

Retuns the byte at the given index.


The documentation for this class was generated from the following file: