/// <summary> /// Store the hash map /// </summary> /// <param name="stream">Stream from whcih file comes</param> /// <param name="Size">Size of the file</param> public void StoreHashMapFile(Stream stream, int Size) { string mapFile = file; // Delete the existing file, any way we are going to store the new one if (File.Exists(mapFile)) { Delete(); } FileStream HashStream = File.OpenWrite(mapFile); try { StreamStream ss = new StreamStream(HashStream); ss.Write(stream, Size); } catch (Exception ex) { throw ex; } finally { HashStream.Close(); } }
public void WriteSingleResponse() { var stream = new MemoryStream (); var streamStream = new StreamStream (new TestStream (null, stream)); streamStream.Write (expectedMessage); byte[] bytes = stream.ToArray (); Assert.IsTrue (messageBytes.SequenceEqual (bytes)); }
public void WriteSingleResponse() { var stream = new MemoryStream(); var streamStream = new StreamStream(new TestStream(null, stream)); Assert.AreEqual(0, streamStream.BytesWritten); Assert.AreEqual(0, streamStream.BytesRead); streamStream.Write(expectedUpdate); Assert.AreEqual(updateBytes.Length, streamStream.BytesWritten); Assert.AreEqual(0, streamStream.BytesRead); Assert.AreEqual(updateBytes.ToHexString(), stream.ToArray().ToHexString()); }
public void WriteSingleResponse() { var stream = new MemoryStream(); var streamStream = new StreamStream(new TestStream(null, stream)); Assert.AreEqual(0, streamStream.BytesWritten); Assert.AreEqual(0, streamStream.BytesRead); streamStream.Write(expectedMessage); byte[] bytes = stream.ToArray(); Assert.AreEqual(bytes.Length, streamStream.BytesWritten); Assert.AreEqual(0, streamStream.BytesRead); Assert.IsTrue(messageBytes.SequenceEqual(bytes)); }