Visual Basic (Declaration) | |
---|---|
Public Function New( _ ByVal rawStream As Stream, _ ByVal start As Long, _ ByVal length As Long, _ ByVal disposeOfStream As Boolean _ ) |
Parameters
- rawStream
- The stream to use for read/write
- start
- The position in the stream that should start the range of allowed bytes
- length
- The maximum length that can be read from the stream
- disposeOfStream
- True to dispose of the rawStream when this stream is disposed
Library/Library.Test/TestClampedStream.cs
C# | Copy Code |
---|---|
MemoryStream ms = new MemoryStream(); BufferedStream bs = new BufferedStream(ms, 1024); using (Stream s = new ClampedStream(bs, 0, long.MaxValue, false)) { s.WriteByte(1); Assert.AreEqual(0, ms.Position); s.Flush(); Assert.AreEqual(1, ms.Position); ms.Position = 0; Assert.AreEqual(1, ms.ReadByte()); } |
VB.NET | Copy Code |
---|---|
Dim ms As New MemoryStream() Dim bs As New BufferedStream(ms, 1024) Using s As Stream = New ClampedStream(bs, 0, Long.MaxValue, False) s.WriteByte(1) Assert.AreEqual(0, ms.Position) s.Flush() Assert.AreEqual(1, ms.Position) ms.Position = 0 Assert.AreEqual(1, ms.ReadByte()) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
ClampedStream ClassClampedStream Members
Overload List