Ejemplo n.º 1
0
        internal RAMOutputStream(RAMFile f)
        {
            file = f;

            // make sure that we switch to the
            // first needed buffer lazily
            currentBufferIndex = -1;
            currentBuffer      = null;
        }
Ejemplo n.º 2
0
		internal RAMOutputStream(RAMFile f)
		{
			file = f;
			
			// make sure that we switch to the
			// first needed buffer lazily
			currentBufferIndex = - 1;
			currentBuffer = null;
		}
Ejemplo n.º 3
0
        public /*internal*/ RAMInputStream(RAMFile f)
        {
            file   = f;
            length = file.length;
            if (length / BUFFER_SIZE >= System.Int32.MaxValue)
            {
                throw new System.IO.IOException("Too large RAMFile! " + length);
            }

            // make sure that we switch to the
            // first needed buffer lazily
            currentBufferIndex = -1;
            currentBuffer      = null;
        }
Ejemplo n.º 4
0
		public /*internal*/ RAMInputStream(RAMFile f)
		{
			file = f;
			length = file.length;
			if (length / BUFFER_SIZE >= System.Int32.MaxValue)
			{
				throw new System.IO.IOException("Too large RAMFile! " + length);
			}
			
			// make sure that we switch to the
			// first needed buffer lazily
			currentBufferIndex = - 1;
			currentBuffer = null;
		}
Ejemplo n.º 5
0
        /// <summary>Creates a new, empty file in the directory with the given name. Returns a stream writing this file. </summary>
        public override IndexOutput CreateOutput(System.String name)
        {
            EnsureOpen();
            RAMFile file = new RAMFile(this);

            lock (this)
            {
                RAMFile existing = fileMap[name];
                if (existing != null)
                {
                    internalSizeInBytes -= existing.sizeInBytes;
                    existing.directory   = null;
                }
                fileMap[name] = file;
            }
            return(new RAMOutputStream(file));
        }
Ejemplo n.º 6
0
 /// <summary>Removes an existing file in the directory.</summary>
 /// <throws>  IOException if the file does not exist </throws>
 public override void  DeleteFile(System.String name)
 {
     lock (this)
     {
         EnsureOpen();
         RAMFile file = fileMap[name];
         if (file != null)
         {
             fileMap.Remove(name);
             file.directory       = null;
             internalSizeInBytes -= file.sizeInBytes;
         }
         else
         {
             throw new System.IO.FileNotFoundException(name);
         }
     }
 }
Ejemplo n.º 7
0
		/// <summary>Creates a new, empty file in the directory with the given name. Returns a stream writing this file. </summary>
		public override IndexOutput CreateOutput(System.String name)
		{
			EnsureOpen();
			RAMFile file = new RAMFile(this);
			lock (this)
			{
				RAMFile existing = fileMap[name];
				if (existing != null)
				{
					internalSizeInBytes -= existing.sizeInBytes;
					existing.directory = null;
				}
				fileMap[name] = file;
			}
			return new RAMOutputStream(file);
		}