internal RAMOutputStream(RAMFile f) { file = f; // make sure that we switch to the // first needed buffer lazily currentBufferIndex = -1; currentBuffer = null; }
internal RAMOutputStream(RAMFile f) { file = f; // make sure that we switch to the // first needed buffer lazily currentBufferIndex = - 1; currentBuffer = null; }
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; }
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; }
/// <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)); }
/// <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); } } }
/// <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); }