Esempio n. 1
0
 /// <exception cref="System.IO.IOException"></exception>
 internal ByteArrayWindow QuickCopy(PackFile p, long pos, long cnt)
 {
     Pin(p, pos);
     if (window is ByteArrayWindow && window.Contains(p, pos + (cnt - 1)))
     {
         return((ByteArrayWindow)window);
     }
     return(null);
 }
Esempio n. 2
0
        /// <exception cref="System.IO.IOException"></exception>
        internal void Pin(PackFile pack, long position)
        {
            ByteWindow w = window;

            if (w == null || !w.Contains(pack, position))
            {
                // If memory is low, we may need what is in our window field to
                // be cleaned up by the GC during the get for the next window.
                // So we always clear it, even though we are just going to set
                // it again.
                //
                window = null;
                window = WindowCache.Get(pack, position);
            }
        }