Show / Hide Table of Contents

Class EncodingExtensions

Represents extension method for Encoding data type.

Inheritance
Object
EncodingExtensions
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Text
Assembly: DotNext.dll
Syntax
public static class EncodingExtensions

Methods

| Improve this Doc View Source

GetBytes(Encoding, ReadOnlySpan<Char>, MemoryAllocator<Byte>)

Encodes a set of characters from the specified read-only span.

Declaration
public static MemoryOwner<byte> GetBytes(this Encoding encoding, ReadOnlySpan<char> chars, MemoryAllocator<byte> allocator = null)
Parameters
Type Name Description
Encoding encoding

The target encoding.

ReadOnlySpan<Char> chars

The characters to encode.

MemoryAllocator<Byte> allocator

The memory allocator.

Returns
Type Description
MemoryOwner<Byte>

The memory containing encoded characters.

Remarks

The caller is responsible for releasing returned memory.

| Improve this Doc View Source

GetChars(Encoding, ReadOnlySpan<Byte>, MemoryAllocator<Char>)

Decodes all the bytes in the specified read-only byte.

Declaration
public static MemoryOwner<char> GetChars(this Encoding encoding, ReadOnlySpan<byte> bytes, MemoryAllocator<char> allocator = null)
Parameters
Type Name Description
Encoding encoding

The target encoding.

ReadOnlySpan<Byte> bytes

The set of bytes representing encoded characters.

MemoryAllocator<Char> allocator

The memory allocator.

Returns
Type Description
MemoryOwner<Char>

The memory containing decoded characters.

| Improve this Doc View Source

WithoutPreamble(Encoding)

Returns Encoding that doesn't generate BOM.

Declaration
public static Encoding WithoutPreamble(this Encoding encoding)
Parameters
Type Name Description
Encoding encoding

The source encoding.

Returns
Type Description
Encoding

The source encoding without BOM.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX