public BufSlice Capture(int size) { size = BufStorage.GetProperSize(size); lock (this) { var node = this.header; while (null != node) { if (0 == node.RefCount && node.Total >= size) { if (node.Total >= (size << 1)) { node.SplitByteArray(size); } node.Retain(); return(node); } node = node.Next; } } return(null); }
public void Submit() { this.readOnly = true; this.Position = 0; var size = BufStorage.GetProperSize(this.Size); if (this.Total >= (size << 1)) { SplitByteArray(size); } }
public BufBlock(BufStorage storage, int size) { this.Storage = storage; this.Buffer = new byte[size]; this.header = new BufSlice(this, 0, size); }