コード例 #1
0
 /// <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;
 }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 /// <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)
 {
 }
コード例 #5
0
 /// <summary><inheritDoc/></summary>
 public virtual long Length()
 {
     return(source.Length());
 }
コード例 #6
0
 public virtual long Length()
 {
     lock (lockObj) {
         return(source.Length());
     }
 }