public int ReloadedStreamReader() { using (var fileStream = _generator.GetMemoryStream()) { var reloadedReader = new BufferedStreamReader(fileStream, BufferSize); int randomInt = 0; for (int x = 0; x < _generator.Structs.Length; x++) { BufferedStreamReaderGetStruct(reloadedReader, out randomInt); } return(randomInt); } }
public int BinaryReader() { using (var fileStream = _generator.GetMemoryStream()) { var binaryReader = new BinaryReader(fileStream); int randomInt = 0; for (int x = 0; x < _generator.Structs.Length; x++) { BinaryReaderGetStruct(binaryReader, out randomInt); } return(randomInt); } }
public void ReadAllElements(int bufferSize) { // Int Structs: Complex using (var memoryStream = _randomIntStructGenerator.GetMemoryStream()) { var reader = new Reloaded.Memory.Streams.BufferedStreamReader(memoryStream, bufferSize); for (int x = 0; x < _randomIntStructGenerator.Structs.Length; x++) { reader.Read(out RandomIntStruct value); Assert.Equal(_randomIntStructGenerator.Structs[x], value); } } // Integers: Primitive using (var memoryStream = _randomIntegerGenerator.GetMemoryStream()) { var reader = new Reloaded.Memory.Streams.BufferedStreamReader(memoryStream, bufferSize); for (int x = 0; x < _randomIntegerGenerator.Structs.Length; x++) { reader.Read(out int value); Assert.Equal(_randomIntegerGenerator.Structs[x], value); } } }