/// <inheritdoc/> public object Clone() { var c = (IDataStream)innerStream.Clone(); if (object.ReferenceEquals(c, innerStream)) { return(this); } return(new MaskedStream(mask, c)); }
/// <inheritdoc/> public object Clone() { var o = (IDataStream)innerStream.Clone(); // test immutability if (object.ReferenceEquals(o, innerStream)) { return(this); } return(new ChunkedStream(o, chunkSize)); }
/// <inheritdoc/> public object Clone() { var tmp = (IDataStream)innerStream.Clone(); // test immutability if (object.ReferenceEquals(tmp, innerStream)) { return(this); } return(new LazyLoggedFile(tmp)); }
public object Clone() { IDataStream nd = null; ICloneable ns = null; if (Data != null) { nd = (IDataStream)Data.Clone(); } if (State != null) { ns = (ICloneable)ns.Clone(); } return(new DataEventArgs { Data = nd, State = ns }); }
/// <summary> /// Add stream to the end of the list /// </summary> /// <param name="s">stream</param> public void Add(IDataStream s) { if (frozen) { throw new InvalidOperationException("StreamList is frozen!"); } s = (IDataStream)s.Clone(); streamsLock.EnterWriteLock(); try { streams.Add(s); Interlocked.Add(ref length, s.Length); } finally { streamsLock.ExitWriteLock(); } }
/// <summary> /// Appends data to builded stream /// </summary> /// <remarks> /// With large lengthThreshold it will take a while to create the LoggedFile. /// </remarks> /// <param name="data"></param> /// <exception cref="ArgumentNullException">data</exception> public void Append(IDataStream data) { if (data == null) { throw new ArgumentNullException("data"); } if (length >= threshold) { fileBuilder.Append(data); } else if (length + data.Length >= threshold) { fileBuilder = logger.CreateFileBuilder(); fileBuilder.Append(list); fileBuilder.Append(data); list = null; } else { list.Add((IDataStream)data.Clone()); } length += data.Length; }