RavenFS.Synchronization.Rdc.Wrapper.StorageSignatureRepository.GetContentForReading C# (CSharp) Метод

GetContentForReading() публичный Метод

public GetContentForReading ( string sigName ) : Stream
sigName string
Результат Stream
		public Stream GetContentForReading(string sigName)
		{
			SignatureReadOnlyStream signatureStream = null;
			_storage.Batch(
				accessor =>
					{
						var signatureLevel = GetSignatureLevel(sigName, accessor);
						if (signatureLevel != null)
						{
							signatureStream = new SignatureReadOnlyStream(_storage, signatureLevel.Id, signatureLevel.Level);
						}
						else
						{
							throw new FileNotFoundException(sigName + " not found in the repo");
						}
					});
			signatureStream.Position = 0;
			return signatureStream;
		}

Usage Example

        public void Should_throw_FileNotFoundException_for_unknown_file()
        {
            transactionalStorage.Batch(accessor =>
            {
                accessor.AddSignature("test", 1, stream => stream.Write(new byte[] { 3 }, 0, 1));
            });

            var tested = new StorageSignatureRepository(transactionalStorage, "test");
            Assert.Throws(typeof(FileNotFoundException), () => tested.GetContentForReading("test.0.sig"));
        }
All Usage Examples Of RavenFS.Synchronization.Rdc.Wrapper.StorageSignatureRepository::GetContentForReading