Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [stream]

A stream is a series of data elements (characters, bytes or complex packets) which can be accessed or made accessible in a serial fashion. Random access is not possible.

2
votes
0answers
34 views

WebAPI: Async Filtering CSV content + Json/XML Serialization

I am coding a csv file filtering api in ASP.NET Core, which takes a csv file located at a given uri (and retrieved via the query string) convert the content to a collection of records, then apply a ...
5
votes
1answer
49 views

C++ API for reading RIFF files

I wrote a simple library for reading RIFF-encoded files in C++. I tried to adhere to modern practices and provide an idiomatic API, but there is one part that sticks like a sore thumb to me: the way ...
6
votes
1answer
185 views

Overloading istream>> to read comma-separated input

I have the following very simple class: ...
2
votes
1answer
42 views

Concatenating an already existing filename to create a new file

I had answered this question from stackoverlow and the code below is code that I wrote to explain to the OP a possible way to achieve what I believe they were looking for. The general idea that I ...
1
vote
0answers
15 views

Stream wrapper in node.ts

I like Node.js and typescript a lot, but i'm still pretty much a newbie with streams. I know how to use them, but I have trouble understanding how the work, what are the consequences of using them, ...
2
votes
1answer
53 views

Formatted reading

I thought it might be useful if reading could at least sort of mirror writing. For example, if I write some output like: ...
0
votes
1answer
53 views

Nested stream to check the truth condition at first instance

Lets say I have Cars with Features, and I have been given a List of features to look for in ...
1
vote
2answers
57 views

Reading new data from a constantly updating file in Java

I have a log file which is constantly updated with new lines of data. I need to get new added data in java as soon as it's written. For now my solution is: ...
1
vote
2answers
70 views

Read integers from coupled lines in a text file

I'm trying to read a text file formatted as in this example: 5 3 3 1 5 6 6 6 1 3 2 5 4 Where the lines are coupled, with the line above always being of length ...
0
votes
1answer
67 views

Convert a stream to Promise

I need to collect all the data from the stream and resolve it as promise. I created this stream: ...
0
votes
1answer
59 views

Text reading and string inputting program [closed]

The Main program. This program pulls from a .txt document with two separate strings, and outputs a .cs program that will display those two string via console when run. It uses a structure.txt file ...
1
vote
0answers
15 views

Swapping variable length strings asynchronously with connected microcontroller (Byte-banging)

I have an AT89S52 and an AT89C4051 microcontroller (both in the 8052 family) in which the bit lines of the data bus, one control pin and one status pin are connected together. In code, the data bus is ...
3
votes
2answers
81 views

Streaming modified lines of a file from a Controller

I am writing a piece of software that aims at streaming the modified lines of an external file located at given uri (and retrieved as a QueryString parameter). I am trying to minimize the impact of ...
5
votes
3answers
107 views

SslStream-compatible ReadLine extension

This code is a Extension to just be able to read a line quickly and efficiently with support for SslStream. What i'm looking to achieve: Lower CPU usage by ...
1
vote
1answer
432 views

Stream operation with two dimensional array

I am trying to find the best average score from below two dimensional array: ...
-1
votes
1answer
44 views

How to use java 8 streams to get more readability and performance to this code [closed]

I got a forms list, and it has a tags list. I received from my front end app an array of tags (String), gotta filter these forms by these tags. ...
5
votes
1answer
592 views

Using Span<> and Memory<> to read UTF8 from a socket

I am experimenting with Span<> and Memory<> and checking how to use it for example for reading UTF8 text from a <...
0
votes
1answer
43 views

Copying contents between BufferedStreams in Java

This is a simple function that copies the content of one stream to another. My question is simple. I am currently, copying between the streams one byte at a time, but the streams are both Buffered. ...
2
votes
2answers
118 views

Read framed nested sensor data from memory stream

I'm implementing a TCP client to read data from a sensor. The sensor sends messages to connected clients framed with a start sequence, messages, checksum and end sum bytes. Because the sensor is ...
0
votes
1answer
40 views

Collect all items containing a word to a Multimap

I have a simple class like class Item { Set<String> wordSet() {...} } So each item has a set of words and I need ...
1
vote
1answer
128 views

Sliding Window Spliterator in Java

I implemented a custom Sliding Window Spliterator in Java. Do you have any ideas how this could be improved? Thinking if replacing the buffer with a plain array could have a positive impact on the ...
7
votes
3answers
141 views

Endless stream: stream a range and return default value if the range is exhausted

Introduction: Motivation Sometimes there is a need to merge N > 1 ranges, and they don't have equal length, but there is a value which can be used in case the range is already exhausted. It is ...
4
votes
1answer
448 views

Multiple client TCP stream reader

My server code is currently reading String data over a TCP connection form 2 different client computers. To do this I am duplicating the ...
2
votes
1answer
47 views

Idiomatic approach to applying a keyword replace algorithm to a Java 8 Stream

I have an approach that seems to work though I feel like I must be misusing something to achieve it. I am implementing a keyword matching algorithm to a Java 8 ...
3
votes
2answers
74 views

Crawl and gather all the urls recursively in a domain

This is the script : ...
2
votes
2answers
76 views

Summing payments by year using Java Streams

I'm using 1.8.0_162 version of Java and here is my task about stream framework ...
5
votes
1answer
453 views

Deflating a Stream using System.IO.Compression

I receive messages from a MessageWebSocket connection frequently, which are compressed with zlib. The following code decompresses them to a stream which can be read ...
4
votes
1answer
123 views

Templated byte streaming

I often have the need to take some type and stream it to something as a sequence of character byte values, so I came up with this to accomplish the task: ...
1
vote
3answers
77 views

Picking from a list of individuals based on their fitness values

I have this method that takes a list of my individuals (class has public field fitnessValue). I sum all fitnessValue and then ...
6
votes
3answers
2k views

File encryption with password

I would like to have my C# cryptography code reviewed. I programmed an application that encrypts files with a password (provided by the user). It basically functions as a password manager, on the ...
0
votes
1answer
46 views

Ensuring performance of sketching/streaming algorithm (countSketch)

I have implemented what is know as a countSketch in python (page 17: https://arxiv.org/pdf/1411.4357.pdf) but my implementation is currently lacking in performance. The algorithm is to compute the ...
0
votes
1answer
517 views

Writing to MemoryStream with foreach

As you can see here: 20% CPU in a 3 minutes and 20 seconds excessive 40 executions async/await at a time for 9700 times caused quite a bit of CPU usage. Code: ...
5
votes
2answers
209 views

Sequencing Collector for Eithers

Using Java 8, I'd like to sequence my eithers using a Collector: Sequencing a stream of eithers means for me: If there's at least one left either inside the stream, I expect the Collector to return ...
3
votes
3answers
153 views

Stopping an infinite stream with collection state

I took up a somewhat interesting challenge when I answered this question. The task is to collect the first occurrences of different types of animals from an infinite stream until you've caught them ...
4
votes
1answer
434 views

Media player subtitles in WPF - Part 1 Processing and storing

I'm writing a media player in WPF and since movies are playable, subtitles are a must. Here's what it looks like so far: On the left is the settings tab, in the middle is the actual player and on ...
3
votes
1answer
27 views

Creating charts for my UPS metrics - Part 2

Following up from my previous question Streaming my UPS metrics for graphical viewing in bash ...
5
votes
1answer
188 views

Optimizing priority queue streaming algorithm in C++

This is a sorting algorithm that I wrote for finding the maximum \$n\$ elements at any time in a stream of IDs and integers with unknown length. I primarily do my coding in Python, so I'm not too ...
1
vote
1answer
125 views

Optimising multiple streams to single loop

I am trying to find the best way to optimise the converters below to first follow the flow I call convertAndGroupForUpdate, which triggers the conversions and ...
5
votes
3answers
1k views

Several approaches to a logging class

I'm making a personal logger and so far I have come up with 3 solutions. I have them simplified in this example to highlight my dilemma. I want to know the pros and cons of my approaches and ways to ...
5
votes
1answer
414 views

Use a standard stream, and restore its settings afterwards

I sometimes find myself changing stream settings (e.g. to output hexadecimal, or to change fill character), and needing to change those settings back afterwards, to avoid perturbing subsequent output. ...
0
votes
2answers
50 views

Java Stream wants to return only failure list

I have an object delivery template, which I want to delete based on a name. String array which contains delivery template name is taken as an input parameter. I use Java Stream to iterate the list. ...
11
votes
5answers
2k views

Counting relevant entries in a large bioinformatics file

I have a working example of a piece of code which opens up a file, gathers information about the contents, and outputs a map which contains the information. The file The file type is an in-house ...
5
votes
1answer
157 views

Read and write Game Save data

I have a class that reads and writes data to and from a .txt file using fstream. As far as I can tell it does exactly what I want it to do: if no file exists create one with default initial ...
3
votes
0answers
114 views

C++ string Formatter Again Part-4

Previously asked here. The code is now available on GitHub. Since the previous review I have added unit tests. Since it is big it will come in a couple of parts. Part 1 | Part 2 | Part 3 | Part 4 ...
4
votes
1answer
129 views

C++ string Formatter Again Part-3

Previously asked here. The code is now available on GitHub. Since the previous review I have added unit tests. Since it is big it will come in a couple of parts. Part 1 | Part 2 | Part 3 | Part 4 ...
4
votes
1answer
110 views

C++ string Formatter Again Part-2

Previously asked here. The code is now available on GitHub. Since the previous review I have added unit tests. Since it is big it will come in a couple of parts. Part 1 | Part 2 | Part 3 | Part 4 ...
6
votes
2answers
175 views

C++ string Formatter Again Part-1

Previously asked here. The code is now available on GitHub. Since the previous review I have added unit tests. Since it is big it will come in a couple of parts. Part 1 | Part 2 | Part 3 | Part 4 ...
-2
votes
1answer
22 views

Fill User Ranges

The method have paramete account object contains ranges list, on other side i call services received list of users each user contains list of ranges . this method should compare ranges received from ...
5
votes
1answer
938 views

C++ Read istream into string with exceptions

Did I cover all the bases? Can this be improved (best practice)? Edit... I've come up with some improvements. When I tried edit the code, the software complained about too much code and too little ...
1
vote
1answer
158 views

Stream helper class for Java 8

The company I work for is stuck with Java 8, and the Streams implementation in Java 8 is nice but somewhat rough around the edges. Here is a helper class I cobbled together, using various snippets ...