/// <summary>Standard constructor</summary> /// <param name="index">the index</param> /// <param name="source">the source</param> /// <param name="offset">the offset of the source in the GroupedRandomAccessSource</param> public SourceEntry(int index, IRandomAccessSource source, long offset) { this.index = index; this.source = source; this.firstByte = offset; this.lastByte = offset + source.Length() - 1; }
/// <summary>Constructs a new OffsetRandomAccessSource</summary> /// <param name="source">the source</param> public GetBufferedRandomAccessSource(IRandomAccessSource source) { this.source = source; this.getBuffer = new byte[(int)Math.Min(Math.Max(source.Length() / 4, 1), 4096)]; this.getBufferStart = -1; this.getBufferEnd = -1; }
public override long Seek(long offset, SeekOrigin origin) { switch (origin) { case SeekOrigin.Begin: position = offset; break; case SeekOrigin.Current: position += offset; break; default: position = offset + source.Length(); break; } return(position); }
/// <summary>Constructs a new OffsetRandomAccessSource that extends to the end of the underlying source</summary> /// <param name="source">the source</param> /// <param name="offset">the amount of the offset to use</param> public WindowRandomAccessSource(IRandomAccessSource source, long offset) : this(source, offset, source.Length() - offset) { }
/// <summary><inheritDoc/></summary> public virtual long Length() { return(source.Length()); }
public virtual long Length() { lock (lockObj) { return(source.Length()); } }