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.

Filter by
Sorted by
Tagged with
3
votes
1answer
54 views

Finding out the indices of common elements in two array lists having duplicate elements

I have two lists which are also having some duplicate elements , i am converting this list to map as key value pair with element index as the value for the key - element List 1 : [1, 2, 3, 4, 5, 6, ...
2
votes
1answer
34 views

Reading bytes between two quotes from a stream and decoding it to its appropriate character set [closed]

This is a component for a lexer which operates on a byte input stream that handles reading and decoding the contents of a string contained within double-quotes. The validity of the encoding is handled ...
5
votes
2answers
59 views

Concisely, robustly, temporarily stashing c++ iostream formats

I got tired of the boilerplate and tedium restoring formatting context, so I made an RAII stasher that relies on the destroy-at-end-of-full-statement temporary semantics. With C++17 I can get it down ...
2
votes
1answer
31 views

Chunking strings to binary block-based output

This is a follow up to Chunking strings to binary output I found the reviews quite helpful in pinpointing what to fix with my code. Here's the result of that update. The format of the output is the ...
6
votes
1answer
44 views

Custom manipulator for changing at what characters a std::istream split words

Introduction By default, input streams (e.g., std::cin or a std::istringstream) split words at space when using the ...
5
votes
2answers
108 views

Chunking strings to binary output

A follow-up to this question is Chunking strings to binary block-based output I have code which takes a text file as input and creates a special binary output form of the input. Specifically, the ...
3
votes
0answers
27 views

PPE object detection with tensorflow and opencv with rtsp streams

I am working on an object detection API implemented in Tensorflow 1.14 and OpenCV 4.1, where my task is to recognize personal protection equipment (PPE) worn by workers at various construction site ...
2
votes
4answers
81 views

User Specified Array Read and Modify

How may this code be improved upon, the user inputs array of specified length and replaces each element that is smaller than the mean of the first and last element with the mean. Is there a better ...
0
votes
1answer
56 views

Compare two map objects and show relative information Java 8

I have 2 maps. First map consists of order in which a specific set of services is executed. Second map contains execution time each service took. I need to display this information. Following is my ...
7
votes
2answers
65 views

Skip input to next line, for reading serialized objects

I was de-serializing objects that had an extra newline that needed to be removed before getting the next object. ...
4
votes
2answers
74 views

Filtering product ids

As regarding the following question I have completed the code as below. But I am curious about other effective solutions. I am also curious about if there is any solution that could be applicable by ...
0
votes
2answers
106 views

Refactor method to Java 8

I have a method that iterate a list of maps if a certain element is found then set value of certain variables and break the loop. I'm trying to revamp this into Java 8. And further if it can be ...
2
votes
1answer
68 views

Get word frequency of a txt file and save it to linked list

I'm a novice in C++. I want to do three things: Get the number of lines in the file Get the number of total words in the file Get each frequency of each "unique ...
6
votes
3answers
196 views

Make my XML Parser in Java using WoodStox run faster and use less memory, or just generally better

I have an XML Parser in Java using WoodStox that I wrote. This parser is going to be parsing through extremely large files, could be 5+GB. The goal of the parser is to convert a nest XML file into a ...
1
vote
0answers
84 views

HTTP Client - Best practices

I've made a HTTP client and would like some tips to improve my code, it's supposed to be built for xamarin forms but should work with any implementation. My goal of this project was to learn more ...
0
votes
0answers
50 views

Downloading large amount of data and storing on Android & iOS

So I have this API that downloads from our web service, but the we service sends it as a ZIP file instead of a json stream or something else. Now the files can get quite large butt they are not ...
1
vote
1answer
61 views
1
vote
1answer
56 views

Image type convertion

So I have a piece a code that, altough it does what is expected, it doesn't seam very performant to me. I just wanted to know if there's a better way to do this or if my code is alright as it is. The ...
2
votes
1answer
41 views

Building a Map of Set using Java Streams

I wrote a collector that would take a stream of Map.Entry<Integer, MyObject> which I want to make into ...
1
vote
0answers
66 views

Stream Exercise: average delta of the yearly average temperature per country

a Temperature calss is given (not allowed to modify it): ...
-1
votes
1answer
53 views

Functional filter unique elements in sequence is not as good as imperative [closed]

Can you please help me fulfill the following? Requirements: Create an iterable with unique elements. Their order should be preserved: a | b | a | c → a | b | c ...
2
votes
1answer
121 views

Converting HashMap data to a Response object

I have a HashMap and I want to convert data in it to a Response object. Is it possible to achieve this code that parses the string in a better and optimized and cleaner way, maybe by using streams? <...
2
votes
1answer
69 views

Converts data in a HashMap to a custom object

I have a HashMap and I want to convert data in it to a Response object, but I do not find it clean and optimized. Is there a ...
6
votes
1answer
51 views

Design a native video buffer in C++ to be shown on android application and shared with other modules in native space and Java

I'm working on a design for a video buffer in C++ that will be used by many consumers both in the native library space(C++) as well as Java side using JNI. My Idea is the following: Have a buffer ...
5
votes
3answers
132 views

Proper way to find newest file in a directory

I wanted to ask if this is a better way to find a latest file in given directory. This is my current approach: ...
4
votes
1answer
319 views

Monitoring Traces for Satisfaction of Temporal Logic Properties

I am trying to implement a monitor for a certain temporal logic. What this means is the following: There is some external source, from which a trace of items are coming. An item looks like a ...
2
votes
0answers
130 views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
2
votes
1answer
171 views

OpenFile function in C++

I am in the process of learning basic C++ and one of the practice questions I came across was to write a function to open a file in C++. I did understand how to use the streams but I think I went ...
-3
votes
1answer
67 views

how to write streams in java [closed]

Q: Given a list of Persons, return the first two Students having the last name starting with “C” My classes: Person class ...
6
votes
2answers
97 views

Printing the max of groups of three random ints

I'm trying to teach myself streaming and lambda expressions. Here's the scenario: I have a collection of 10 Thing objects each containing an int[] of 3 random number. I've written code to print out ...
1
vote
1answer
52 views

Is there better alternative to making an optional set of elements from iterable in java?

I'm feeling uneasy with this service method that I wrote: ...
9
votes
5answers
228 views

Stream text scanning

I've written some utilities to read text from streams. One of these, the ReadTo method, is to read text from a specified stream until a given text is encountered, ...
5
votes
1answer
51 views

Stack Exchange graph data - helper modules

Building on previous reviews Whilst not an iterative review I have tried to follow the advice provided to some of my older questions: KISS, in some of my previous questions I've over complicated the ...
4
votes
1answer
57 views

Reading from a stream but reserving N bytes at the end of stream

What I'd like to do is read data from a stream (like ifstream::read), but reserve N = 4 bytes from being returned. The last 4 bytes of the stream are not part of the data itself, but are metadata. In ...
2
votes
1answer
127 views

Group a list of strings by length

Is it possible to write this using the stream element? I can get the most of it with stream but it is the add adding string to list which is in the map that I am caught on. ...
2
votes
0answers
37 views

Middleware for authenticating GitHub webhooks

I'm currently working on a PSR-15 middleware for authenticating GitHub webhooks. ...
1
vote
0answers
29 views

Encrypted network protocol in NodeJS

This is just an exercise. I know I should not implement encryption protocol myself. I know I should use Node's TLS package. I know I do not authenticate other side, but merely encrypting traffic. I ...
3
votes
3answers
161 views

A stream version of Fizz Buzz

I'm trying to learn streams and hashmaps, in doing so I want to make a very scalable, very clean version of FizzBuzz while adhering to the book Clean Code by Robert Cecil Martin. ...
3
votes
0answers
97 views

Reading and parsing binary file from CAEN Digitizer (written by WaveDump)

Preliminaries I have CAEN Digitizer N6720A and use WaveDump software for the data acquisition and recording. As a result of data recording this software produces a binary file in which the sequence ...
4
votes
0answers
459 views

C++ network stream

So, I'm new to socket programming. I wanted to get started learning, and start making stuff, but was really surprised to find out there was no standard C++ network library yet. I'd have to look for a ...
-1
votes
1answer
59 views

java for loop with map merge [closed]

Simple conversion of one type to another. Is there a better way with streams : ...
2
votes
0answers
184 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
97 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 ...
7
votes
1answer
452 views

Overloading istream>> to read comma-separated input

I have the following very simple class: ...
3
votes
1answer
68 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
22 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, ...
4
votes
1answer
67 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
56 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
247 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
77 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 ...

1
2 3 4 5 6