public ByteArray Capture(int size) { size = ByteStorage.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 = ByteStorage.GetProperSize(this.size); if (this.total >= (size << 1)) { SplitByteArray(size); } }
public ByteBlock(ByteStorage storage, int size) { this.storage = storage; this.buffer = new byte[size]; this.header = new ByteArray(this, 0, size); }