Accord.Imaging.Formats.PNMCodec.ReadUntilSpace C# (CSharp) Method

ReadUntilSpace() private static method

private static ReadUntilSpace ( Stream stream, byte buffer, int start ) : int
stream Stream
buffer byte
start int
return int
        private static int ReadUntilSpace(Stream stream, byte[] buffer, int start)
        {
            byte nextByte = (byte)stream.ReadByte();
            int bytesRead = 0;

            while ((nextByte != ' ') && (nextByte != '\n') && (nextByte != '\r') && (nextByte != '\t') && (nextByte != '#'))
            {
                buffer[start + bytesRead] = nextByte;
                bytesRead++;
                nextByte = (byte)stream.ReadByte();
            }

            return bytesRead;
        }
    }