コード例 #1
0
        protected internal virtual InputStream GetInputStream()
        {
            switch (status)
            {
            case ByteRangeInputStream.StreamStatus.Normal:
            {
                break;
            }

            case ByteRangeInputStream.StreamStatus.Seek:
            {
                if (@in != null)
                {
                    @in.Close();
                }
                @in    = OpenInputStream();
                status = ByteRangeInputStream.StreamStatus.Normal;
                break;
            }

            case ByteRangeInputStream.StreamStatus.Closed:
            {
                throw new IOException("Stream closed");
            }
            }
            return(@in);
        }
コード例 #2
0
 /// <exception cref="System.IO.IOException"/>
 public override void Close()
 {
     if (@in != null)
     {
         @in.Close();
         @in = null;
     }
     status = ByteRangeInputStream.StreamStatus.Closed;
 }
コード例 #3
0
 /// <summary>Seek to the given offset from the start of the file.</summary>
 /// <remarks>
 /// Seek to the given offset from the start of the file.
 /// The next read() will be from that location.  Can't
 /// seek past the end of the file.
 /// </remarks>
 /// <exception cref="System.IO.IOException"/>
 public override void Seek(long pos)
 {
     if (pos != currentPos)
     {
         startPos   = pos;
         currentPos = pos;
         if (status != ByteRangeInputStream.StreamStatus.Closed)
         {
             status = ByteRangeInputStream.StreamStatus.Seek;
         }
     }
 }