Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:23:21+00:00 2026-05-28T08:23:21+00:00

I am working on parsing a fairly complicated data stream generated by a usb

  • 0

I am working on parsing a fairly complicated data stream generated by a usb device that emulates a keyboard. The easiest way for me to conceptualize and deal with the data would be if I had a method called something like GetNextInputCharacter, and I could do all the parsing in one go without having to do it one piece at a time as I receive input. Unfortunately I won’t know how many bytes to expect in the stream until I have parsed into it significantly, and I would rather not wait until the end to parse it anyway.

Is there any mechanism or design pattern that can take asynchronous input from the key event and pass it to my parse method on demand? All I can think of is an IEnumerable that does a busy wait on a FIFO that the key event populates and yields them out one at a time. That seems like a bit of a hack, but maybe it would work. I just want a way for the parse routine to pretend like the input is already there and take it without knowing that it has to wait for the events.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:23:22+00:00Added an answer on May 28, 2026 at 8:23 am

    How about something like this:

            ...
            var stream = //Set up stream 
            var data = from dataStream in StreamStuff(stream) select dataStream;
            ...
            private IEnumerable<String> StreamStuff(Stream stream)
            {
                stream.Open();
                while(stream.Read())
                {
                    //Do some stuff to your read value
                    yield return yourProcessedData;
                }
                stream.Close();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an existing data parsing program that overlays a struct onto a
I been working on parsing out bookmarks from an export file generated by google
I'm working on developing a fairly robust 2D game engine as a base that
The website I'm working on has some fairly complicated routing structures and we're experiencing
I have been working with parsing data, I got a string like: Scottish Premier
Already i have worked on SBJSON parsing, that was working very fine. Now, i
I am working on a project that requires the parsing of formatting tags. By
I'm fairly new to Python, and I've just started working with XML parsing. I
Alright, so I'm currently working on parsing an RSS feed. I've gotten the data
I'm currently working with parsing some data from SQL Server and I'm in need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.