Exemple #1
0
        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);
        }
Exemple #2
0
 public HeaderReader(byte[] boundaryBytes, IMultiPartStreamState next)
 {
     this.boundaryBytes = boundaryBytes;
     this.header = new byte[boundaryBytes.Length];
     this.next = next;
 }
Exemple #3
0
 void ProcessByte(byte value)
 {
     state = state.ProcessByte(value);
 }