Read() public abstract method

Read a single cache item from the input stream.
public abstract Read ( Stream inputStream ) : ICacheItem
inputStream Stream
return ICacheItem
Exemplo n.º 1
0
        private Dictionary <string, ICacheItem> Load(Stream s)
        {
            Dictionary <string, ICacheItem> table = new Dictionary <string, ICacheItem>();
            int itemCount = UtilityMethods.ReadInt32(s);

            for (int i = 0; i < itemCount; i++)
            {
                try
                {
                    string     key = UtilityMethods.ReadString(s);
                    ICacheItem val = persister.Read(s);
                    if (val == null) // corrupt cache file
                    {
                        return(table);
                    }

                    table[key] = val;
                }
                catch (IOException)
                {
                    return(table);
                }
            }
            return(table);
        }