1、介绍
- ByteBuffer俗称缓冲器,是将数据移进移除通道的唯一方式,并且只能创建一个独立的基本类型缓冲器;
- ByteBuffer中存放的是字节。
2、相关代码
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
public class ByteBuffer
{
private MemoryStream stream = null;
private BinaryWriter writer = null;
private BinaryReader reader = null;
private BufferType bufferType = BufferType.Low;
/// <summary>
/// 实例化
/// </summary>
/// <param name="bufferType">默认字节流由低到高</param>
public ByteBuffer(BufferType bufferType = BufferType.Low)
{
stream = new MemoryStream();
writer = new BinaryWriter(stream);
this.bufferType = bufferType;
}
/// <summary>
/// 实例化
/// </sum
|