public override State Transit(Stream stream) { var @byte = stream.ReadByte(); if (@byte == -1) { return(this); } if (@byte == '-') { // | // -1\r\n return(Seek.Get(3)); } if (@byte == '0') { // | // 0\r\n return(Seek.Get(2)); } return(new ArrayLength(@byte - '0')); }
public override State Transit(Stream stream) { var length = partiallyParsedLength; while (true) { var @byte = stream.ReadByte(); if (@byte == -1) { return(length == partiallyParsedLength ? this : new ArrayLength(length)); } if (@byte == '\r') { // \n (length items) return(new Serial( Seek.Get(1), Array.Get(length) )); } length = length * 10 + @byte - '0'; } }
public override State Transit(Stream stream) { var @byte = stream.ReadByte(); if (@byte == -1) { return(this); } if (@byte == '-') { // | // "-1\r\n" return(Seek.Get(3)); } if (@byte == '0') { // | // 0\r\n\r\n return(Seek.Get(4)); } return(new BulkString(@byte - '0')); }
public override State Transit(Stream stream) { while (true) { var @byte = stream.ReadByte(); if (@byte == -1) { return(this); } if (@byte == '\r') { return(Seek.Get(1)); } } }
public override State Transit(Stream stream) { var length = partiallyParsedLength; while (true) { var @byte = stream.ReadByte(); if (@byte == -1) { return(length == partiallyParsedLength ? this : new BulkString(length)); } if (@byte == '\r') { // \n content \r\n return(Seek.Get(length + Sizes.LF + Sizes.CRLF)); } length = length * 10 + @byte - '0'; } }