/// <param name="blockLength">Длина единоразово записываемого байтового массива.</param>
        public void Write(Stream stream, int blockLength, ISizeableStorage <long, NumberedByteBlock> storage)
        {
            IEnumerable <NumberedByteBlock> blocks = StorageEnumerableProvider.ProvideNew(storage);
            IWriter writer = StreamWriterProvider.ProvideNew(stream, _bytePool, blocks);

            writer.Write();
        }
Ejemplo n.º 2
0
        /// <param name="blockLength">Длина единоразово считываемого байтового массива.</param>
        public ISizeableStorage <long, NumberedByteBlock> Read(Stream stream, int blockLength)
        {
            long totalCountOfBlocks = Utils.CalculateCountOfBlocks(stream.Length, blockLength);
            ISizeableStorage <long, NumberedByteBlock> storage = StorageProvider.ProvideNew(totalCountOfBlocks);
            IReader reader = StreamReaderProvider.ProvideNew(stream, blockLength, _bytePool, storage);

            reader.Read();
            return(storage);
        }
Ejemplo n.º 3
0
 public IEnumerable <TValue> ProvideNew(ISizeableStorage <long, TValue> storage)
 => new NumericStorageEnumerable <TValue>(storage);
Ejemplo n.º 4
0
 public NumericStorageEnumerator(ISizeableStorage <long, TValue> storage)
 {
     _storage = storage;
     _counter = 0;
     Current  = default(TValue);
 }
Ejemplo n.º 5
0
 public NumericStorageEnumerable(ISizeableStorage <long, TValue> storage)
 {
     _storage = storage;
 }
        /// <summary>
        /// Перекачивает байты из одного заданного потока в другой по частям.
        /// </summary>
        public virtual void Pump(Stream source, Stream target)
        {
            ISizeableStorage <long, NumberedByteBlock> byteBlocks = _reader.Read(source, BlockLength);

            _writer.Write(target, BlockLength, byteBlocks);
        }