public MultiPartStream(string boundary) { var boundryLength = Encoding.GetByteCount(boundary); var boundaryBytes = new byte[BoundaryPrefix.Length + boundryLength]; BoundaryPrefix.CopyTo(boundaryBytes, 0); Encoding.GetBytes(boundary, 0, boundary.Length, boundaryBytes, BoundaryPrefix.Length); var body = new BodyReader(boundaryBytes, (bytes, lines, bodyStartPosition, bodyLength) => OnPartReady(ReadPart(bytes, lines, bodyStartPosition, bodyLength))); state = new HeaderReader(boundaryBytes, body); }
public HeaderReader(byte[] boundaryBytes, IMultiPartStreamState next) { this.boundaryBytes = boundaryBytes; this.header = new byte[boundaryBytes.Length]; this.next = next; }
void ProcessByte(byte value) { state = state.ProcessByte(value); }