Immutable array of bytes.
Properties |
|
---|---|
Empty
|
Returns an empty ByteString.
|
IsEmpty
|
bool
Returns
true if this byte string is empty, false otherwise. |
Length
|
int
Returns the length of this ByteString in bytes.
|
this[int index]
|
byte
Returns the byte at the given index.
|
Public functions |
|
---|---|
CopyTo(byte[] array, int position)
|
void
Copies the entire byte array to the destination array provided at the offset specified.
|
CreateCodedInput()
|
Creates a CodedInputStream from this ByteString's data.
|
Equals(object obj)
|
override bool
Compares this byte string with another object.
|
Equals(ByteString other)
|
bool
Compares this byte string with another.
|
GetEnumerator()
|
IEnumerator< byte >
Returns an iterator over the bytes in this ByteString.
|
GetHashCode()
|
override int
Returns a hash code for this object.
|
ToBase64()
|
string
Converts this ByteString into a standard base64 representation.
|
ToByteArray()
|
byte[]
Converts this ByteString into a byte array.
|
ToString(Encoding encoding)
|
string
Converts this ByteString into a string by applying the given encoding.
|
ToStringUtf8()
|
string
Converts this ByteString into a string by applying the UTF-8 encoding.
|
WriteTo(Stream outputStream)
|
void
Writes the entire byte array to the provided stream
|
Public static functions |
|
---|---|
CopyFrom(params byte[] bytes)
|
Constructs a ByteString from the given array.
|
CopyFrom(byte[] bytes, int offset, int count)
|
Constructs a ByteString from a portion of a byte array.
|
CopyFrom(string text, Encoding encoding)
|
Creates a new ByteString by encoding the specified text with the given encoding.
|
CopyFromUtf8(string text)
|
Creates a new ByteString by encoding the specified text in UTF-8.
|
FromBase64(string bytes)
|
Constructs a ByteString from the Base64 Encoded String.
|
operator!=(ByteString lhs, ByteString rhs)
|
bool
Compares two byte strings for inequality.
|
operator==(ByteString lhs, ByteString rhs)
|
bool
Compares two byte strings for equality.
|
bool IsEmpty
Returns true
if this byte string is empty, false
otherwise.
byte this[int index]
Returns the byte at the given index.
void CopyTo( byte[] array, int position )
Copies the entire byte array to the destination array provided at the offset specified.
CodedInputStream CreateCodedInput()
Creates a CodedInputStream from this ByteString's data.
override bool Equals( object obj )
Compares this byte string with another object.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
bool Equals( ByteString other )
Compares this byte string with another.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
true if other refers to an equal byte string; false otherwise. |
IEnumerator< byte > GetEnumerator()
Returns an iterator over the bytes in this ByteString.
Details | |
---|---|
Returns |
An iterator over the bytes in this object.
|
override int GetHashCode()
Returns a hash code for this object.
Two equal byte strings will return the same hash code.
Details | |
---|---|
Returns |
A hash code for this object.
|
string ToBase64()
Converts this ByteString into a standard base64 representation.
Details | |
---|---|
Returns |
A base64 representation of this
ByteString . |
byte[] ToByteArray()
Converts this ByteString into a byte array.
The data is copied - changes to the returned array will not be reflected in this ByteString
.
Details | |
---|---|
Returns |
A byte array with the same data as this
ByteString . |
string ToString( Encoding encoding )
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.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The result of decoding the binary data with the given decoding.
|
string ToStringUtf8()
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.
Details | |
---|---|
Returns |
The result of decoding the binary data with the given decoding.
|
void WriteTo( Stream outputStream )
Writes the entire byte array to the provided stream
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.
ByteString CopyFrom( byte[] bytes, int offset, int count )
Constructs a ByteString from a portion of a byte array.
ByteString CopyFrom( string text, Encoding encoding )
Creates a new ByteString by encoding the specified text with the given encoding.
ByteString CopyFromUtf8( string text )
Creates a new ByteString by encoding the specified text in UTF-8.
ByteString FromBase64( string bytes )
Constructs a ByteString from the Base64 Encoded String.
bool operator!=( ByteString lhs, ByteString rhs )
Compares two byte strings for inequality.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
false if the byte strings are equal; true otherwise. |
bool operator==( ByteString lhs, ByteString rhs )
Compares two byte strings for equality.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
true if the byte strings are equal; false otherwise. |