Created
March 11, 2013 08:58
-
-
Save thecodejunkie/5132898 to your computer and use it in GitHub Desktop.
RequestStream modification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public RequestStream(Stream stream, long expectedLength, long thresholdLength, bool disableStreamSwitching) | |
{ | |
this.thresholdLength = thresholdLength; | |
this.disableStreamSwitching = disableStreamSwitching; | |
this.stream = stream ?? this.CreateDefaultMemoryStream(expectedLength); | |
ThrowExceptionIfCtorParametersWereInvalid(this.stream, expectedLength, this.thresholdLength); | |
this.MoveStreamOutOfMemoryIfExpectedLengthExceedExpectedLength(expectedLength); | |
this.MoveStreamOutOfMemoryIfContentsLengthExceedThresholdAndSwitchingIsEnabled(); | |
if(!this.stream.CanSeek) | |
{ | |
this.stream = | |
this.CreateDefaultMemoryStream(expectedLength); | |
stream.CopyTo(this.stream); | |
} | |
this.stream.Position = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment