public static ByteBuffer FromBuffer(byte[] data) { ByteBuffer buffer = new ByteBuffer(); buffer._buffer = data; buffer._capacity = buffer.Length = data.Length; return buffer; }
public static ByteBuffer WithCapactiy(int capacity) { ByteBuffer buffer = new ByteBuffer(); buffer._buffer = new byte[capacity]; buffer._capacity = capacity; return buffer; }