Class BEncodedString
Class representing a BEncoded string
Inheritance
System.Object
BEncodedString
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: MonoTorrent.dll
Syntax
public class BEncodedString : BEncodedValue, IComparable<BEncodedString>
Constructors
BEncodedString()
Create a new BEncodedString using UTF8 encoding
Declaration
BEncodedString(Byte[])
Create a new BEncodedString using UTF8 encoding
Declaration
public BEncodedString(byte[] value)
Parameters
| Type |
Name |
Description |
| System.Byte[] |
value |
|
BEncodedString(Char[])
Create a new BEncodedString using UTF8 encoding
Declaration
public BEncodedString(char[] value)
Parameters
| Type |
Name |
Description |
| System.Char[] |
value |
|
BEncodedString(String)
Create a new BEncodedString using UTF8 encoding
Declaration
public BEncodedString(string value)
Parameters
| Type |
Name |
Description |
| System.String |
value |
Initial value for the string
|
Properties
Text
The value of the BEncodedString interpreted as a UTF-8 string. If the underlying bytes
cannot be represented in UTF-8 then the invalid byte sequence is silently discarded.
Declaration
public string Text { get; }
Property Value
| Type |
Description |
| System.String |
|
TextBytes
The underlying byte[] associated with this BEncodedString
Declaration
public byte[] TextBytes { get; }
Property Value
| Type |
Description |
| System.Byte[] |
|
Methods
CompareTo(BEncodedString)
Declaration
public int CompareTo(BEncodedString other)
Parameters
Returns
| Type |
Description |
| System.Int32 |
|
CompareTo(Object)
Declaration
public int CompareTo(object other)
Parameters
| Type |
Name |
Description |
| System.Object |
other |
|
Returns
| Type |
Description |
| System.Int32 |
|
Encode(Byte[], Int32)
Encodes the BEncodedString to a byte[] using the supplied Encoding
Declaration
public override int Encode(byte[] buffer, int offset)
Parameters
| Type |
Name |
Description |
| System.Byte[] |
buffer |
The buffer to encode the string to
|
| System.Int32 |
offset |
The offset at which to save the data to
|
Returns
| Type |
Description |
| System.Int32 |
The number of bytes encoded
|
Overrides
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
FromUrlEncodedString(String)
Declaration
public static BEncodedString FromUrlEncodedString(string urlEncodedValue)
Parameters
| Type |
Name |
Description |
| System.String |
urlEncodedValue |
|
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.Object.GetHashCode()
IsNullOrEmpty(BEncodedString)
Declaration
public static bool IsNullOrEmpty(BEncodedString value)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
LengthInBytes()
Declaration
public override int LengthInBytes()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
ToHex()
Declaration
Returns
| Type |
Description |
| System.String |
|
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.Object.ToString()
UrlEncode()
Declaration
public string UrlEncode()
Returns
| Type |
Description |
| System.String |
|
Operators
Implicit(Byte[] to BEncodedString)
Declaration
public static implicit operator BEncodedString(byte[] value)
Parameters
| Type |
Name |
Description |
| System.Byte[] |
value |
|
Returns
Implicit(Char[] to BEncodedString)
Declaration
public static implicit operator BEncodedString(char[] value)
Parameters
| Type |
Name |
Description |
| System.Char[] |
value |
|
Returns
Implicit(String to BEncodedString)
Declaration
public static implicit operator BEncodedString(string value)
Parameters
| Type |
Name |
Description |
| System.String |
value |
|
Returns
Implements
System.IComparable<T>