Fantasy
搜索结果

    显示/隐藏目录

    ByteHelper 类

    提供字节操作辅助方法的静态类。

    继承
    object
    ByteHelper
    继承成员
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    命名空间: Fantasy.Helper
    程序集: Fantasy.Net.dll
    语法
    public static class ByteHelper

    方法

    | 编辑本文 查看源代码

    GetBytes(int, byte[])

    根据int值获取字节数组。

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void GetBytes(this int value, byte[] buffer)
    参数
    类型 名称 描述
    int value
    byte[] buffer
    异常
    类型 条件
    ArgumentException
    | 编辑本文 查看源代码

    GetBytes(long, byte[])

    根据int值获取字节数组。

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void GetBytes(this long value, byte[] buffer)
    参数
    类型 名称 描述
    long value
    byte[] buffer
    异常
    类型 条件
    ArgumentException
    | 编辑本文 查看源代码

    GetBytes(ref uint, byte[])

    根据uint值获取字节数组。

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void GetBytes(this ref uint value, byte[] buffer)
    参数
    类型 名称 描述
    uint value
    byte[] buffer
    异常
    类型 条件
    ArgumentException
    | 编辑本文 查看源代码

    MergeBytes(byte[], byte[])

    合并两个字节数组。

    声明
    public static byte[] MergeBytes(byte[] bytes, byte[] otherBytes)
    参数
    类型 名称 描述
    byte[] bytes

    第一个字节数组

    byte[] otherBytes

    第二个字节数组

    返回
    类型 描述
    byte[]

    合并后的字节数组

    | 编辑本文 查看源代码

    ReadInt32(FileStream)

    从指定的文件流中读取一个 32 位整数。

    声明
    public static int ReadInt32(FileStream stream)
    参数
    类型 名称 描述
    FileStream stream
    返回
    类型 描述
    int
    | 编辑本文 查看源代码

    ReadInt32(MemoryStream)

    从指定的内存流中读取一个 32 位整数。

    声明
    public static int ReadInt32(MemoryStream stream)
    参数
    类型 名称 描述
    MemoryStream stream
    返回
    类型 描述
    int
    | 编辑本文 查看源代码

    ReadInt64(FileStream)

    从指定的文件流中读取一个 64 位整数。

    声明
    public static long ReadInt64(FileStream stream)
    参数
    类型 名称 描述
    FileStream stream
    返回
    类型 描述
    long
    | 编辑本文 查看源代码

    ReadInt64(MemoryStream)

    从指定的内存流中读取一个 64 位整数。

    声明
    public static long ReadInt64(MemoryStream stream)
    参数
    类型 名称 描述
    MemoryStream stream
    返回
    类型 描述
    long
    | 编辑本文 查看源代码

    ToHex(byte)

    将字节转换为十六进制字符串表示。

    声明
    public static string ToHex(this byte b)
    参数
    类型 名称 描述
    byte b
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    ToHex(byte[])

    将字节数组转换为十六进制字符串表示。

    声明
    public static string ToHex(this byte[] bytes)
    参数
    类型 名称 描述
    byte[] bytes
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    ToHex(byte[], int, int)

    将字节数组的指定范围按十六进制格式转换为字符串表示。

    声明
    public static string ToHex(this byte[] bytes, int offset, int count)
    参数
    类型 名称 描述
    byte[] bytes
    int offset
    int count
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    ToHex(byte[], string)

    将字节数组按指定格式转换为十六进制字符串表示。

    声明
    public static string ToHex(this byte[] bytes, string format)
    参数
    类型 名称 描述
    byte[] bytes
    string format
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    ToReadableSpeed(long)

    将字节数转换为可读的速度表示。

    声明
    public static string ToReadableSpeed(this long byteCount)
    参数
    类型 名称 描述
    long byteCount

    字节数

    返回
    类型 描述
    string

    可读的速度表示

    | 编辑本文 查看源代码

    ToReadableSpeed(ulong)

    将字节数转换为可读的速度表示。

    声明
    public static string ToReadableSpeed(this ulong byteCount)
    参数
    类型 名称 描述
    ulong byteCount

    字节数

    返回
    类型 描述
    string

    可读的速度表示

    | 编辑本文 查看源代码

    ToStr(byte[])

    将字节数组转换为默认编码的字符串表示。

    声明
    public static string ToStr(this byte[] bytes)
    参数
    类型 名称 描述
    byte[] bytes
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    ToStr(byte[], int, int)

    将字节数组的指定范围按默认编码转换为字符串表示。

    声明
    public static string ToStr(this byte[] bytes, int index, int count)
    参数
    类型 名称 描述
    byte[] bytes
    int index
    int count
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    Utf8ToStr(byte[])

    将字节数组转换为 UTF-8 编码的字符串表示。

    声明
    public static string Utf8ToStr(this byte[] bytes)
    参数
    类型 名称 描述
    byte[] bytes
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    Utf8ToStr(byte[], int, int)

    将字节数组的指定范围按 UTF-8 编码转换为字符串表示。

    声明
    public static string Utf8ToStr(this byte[] bytes, int index, int count)
    参数
    类型 名称 描述
    byte[] bytes
    int index
    int count
    返回
    类型 描述
    string
    | 编辑本文 查看源代码

    WriteBytes(MemoryStream, int)

    根据int值获取字节数组。

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void WriteBytes(this MemoryStream memoryStream, int value)
    参数
    类型 名称 描述
    MemoryStream memoryStream
    int value
    异常
    类型 条件
    ArgumentException
    | 编辑本文 查看源代码

    WriteBytes(MemoryStream, long)

    根据uint值获取字节数组。

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void WriteBytes(this MemoryStream memoryStream, long value)
    参数
    类型 名称 描述
    MemoryStream memoryStream
    long value
    异常
    类型 条件
    ArgumentException
    | 编辑本文 查看源代码

    WriteBytes(MemoryStream, uint)

    根据uint值获取字节数组。

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void WriteBytes(this MemoryStream memoryStream, uint value)
    参数
    类型 名称 描述
    MemoryStream memoryStream
    uint value
    异常
    类型 条件
    ArgumentException
    | 编辑本文 查看源代码

    WriteTo(byte[], int, byte)

    将字节写入字节数组的指定偏移位置。

    声明
    public static void WriteTo(this byte[] bytes, int offset, byte num)
    参数
    类型 名称 描述
    byte[] bytes
    int offset
    byte num
    | 编辑本文 查看源代码

    WriteTo(byte[], int, short)

    将有符号短整数写入字节数组的指定偏移位置。

    声明
    public static void WriteTo(this byte[] bytes, int offset, short num)
    参数
    类型 名称 描述
    byte[] bytes
    int offset
    short num
    | 编辑本文 查看源代码

    WriteTo(byte[], int, int)

    将有符号整数写入字节数组的指定偏移位置。

    声明
    public static void WriteTo(this byte[] bytes, int offset, int num)
    参数
    类型 名称 描述
    byte[] bytes
    int offset
    int num
    | 编辑本文 查看源代码

    WriteTo(byte[], int, ushort)

    将无符号短整数写入字节数组的指定偏移位置。

    声明
    public static void WriteTo(this byte[] bytes, int offset, ushort num)
    参数
    类型 名称 描述
    byte[] bytes
    int offset
    ushort num
    | 编辑本文 查看源代码

    WriteTo(byte[], int, uint)

    将无符号整数写入字节数组的指定偏移位置。

    声明
    public static void WriteTo(this byte[] bytes, int offset, uint num)
    参数
    类型 名称 描述
    byte[] bytes
    int offset
    uint num
    • 编辑本文
    • 查看源代码
    本文内容
    Back to top Generated by DocFX