コード例 #1
0
        public RAMOutputStream(RAMFile f)
        {
            file = f;

            // make sure that we switch to the
            // first needed buffer lazily
            currentBufferIndex = -1;
            currentBuffer      = null;
        }
コード例 #2
0
ファイル: RAMDirectory.cs プロジェクト: YAFNET/YAFNET
        /// <summary>
        /// Creates a new, empty file in the directory with the given name. Returns a stream writing this file. </summary>
        public override IndexOutput CreateOutput(string name, IOContext context)
        {
            EnsureOpen();
            RAMFile file = NewRAMFile();

            if (m_fileMap.TryRemove(name, out RAMFile existing) && existing != null)
            {
                m_sizeInBytes.AddAndGet(-existing.m_sizeInBytes);
                existing.directory = null;
            }
            m_fileMap[name] = file;
            return(new RAMOutputStream(file));
        }
コード例 #3
0
        public RAMInputStream(string name, RAMFile f)
            : base("RAMInputStream(name=" + name + ")")
        {
            file   = f;
            length = file.length;
            if (length / BUFFER_SIZE >= int.MaxValue)
            {
                throw new IOException("RAMInputStream too large length=" + length + ": " + name);
            }

            // make sure that we switch to the
            // first needed buffer lazily
            currentBufferIndex = -1;
            currentBuffer      = null;
        }