Questions tagged [stream]

DO NOT USE FOR THE JAVA STREAM API INTRODUCED IN JAVA 8 (use [java-stream] for those questions!) A stream is a series of data elements which can be accessed in a serial fashion.

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.

The term stream is also used for streaming media, a method in which the media can be played while it is being accessed (no full download required). The ability to stream media is largely dependent on the container format used. Seeking functionality in streaming media is typically achieved through a different protocol, for example RTSP or HTTP 1.1's Range function.

15725 questions
64
votes
4 answers

How can I write MemoryStream to byte[]

Possible Duplicate: Creating a byte array from a stream I'm trying to create text file in memory and write it byte[]. How can I do this? public byte[] GetBytes() { MemoryStream fs = new MemoryStream(); TextWriter tx = new…
Polaris
  • 3,643
  • 10
  • 50
  • 61
63
votes
6 answers

HttpWebRequest & Native GZip Compression

When requesting a page with Gzip compression I am getting a lot of the following errors: System.IO.InvalidDataException: The CRC in GZip footer does not match the CRC calculated from the decompressed data I am using native GZipStream to…
Pat
  • 5,263
  • 1
  • 36
  • 53
62
votes
6 answers

Write StringBuilder to Stream

What is the best method of writing a StringBuilder to a System.IO.Stream? I am currently doing: StringBuilder message = new StringBuilder("All your base"); message.Append(" are belong to us"); System.IO.MemoryStream stream = new…
Andy Joiner
  • 5,932
  • 3
  • 45
  • 72
62
votes
3 answers

Can you "stream" images to ffmpeg to construct a video, instead of saving them to disk?

My work recently involves programmatically making videos. In python, the typical workflow looks something like this: import subprocess, Image, ImageDraw for i in range(frames_per_second * video_duration_seconds): img = createFrame(i) …
Brandon
  • 975
  • 1
  • 8
  • 19
62
votes
4 answers

What is a stream in C++?

I have been hearing about streams, more specifically file streams. So what are they? Is it something that has a location in the memory? Is it something that contains data? Is it just a connection between a file and an object?
Mohamed Ahmed Nabil
  • 3,949
  • 8
  • 36
  • 49
61
votes
7 answers

C++ custom stream manipulator that changes next item on stream

In C++, to print a number in hexadecimal you do this: int num = 10; std::cout << std::hex << num; // => 'a' I know I can create a manipulator that just adds stuff to the stream like so: std::ostream& windows_feed(std::ostream& out) { out <<…
Tristan Havelick
  • 67,400
  • 20
  • 54
  • 64
59
votes
3 answers

What is partition key in AWS Kinesis all about?

I was reading about AWS Kinesis. In the following program, I write data into the stream named TestStream. I ran this piece of code 10 times, inserting 10 records into the stream. var params = { Data: 'More Sample data into the test stream ...', …
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
59
votes
7 answers

Error "This stream does not support seek operations" in C#

I'm trying to get an image from an url using a byte stream. But i get this error message: This stream does not support seek operations. This is my code: byte[] b; HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url); WebResponse myResp =…
Yustme
  • 6,125
  • 22
  • 75
  • 104
57
votes
9 answers

StandardOutput.ReadToEnd() hangs

I have a program that frequently uses an external program and reads its outputs. It works pretty well using your usual process redirect output, but one specific argument for some reason hangs when I try to read it, no error message - no exception,…
Elad Avron
  • 1,411
  • 1
  • 18
  • 28
57
votes
4 answers

Why do C++ streams use char instead of unsigned char?

I've always wondered why the C++ Standard library has instantiated basic_[io]stream and all its variants using the char type instead of the unsigned char type. char means (depending on whether it is signed or not) you can have overflow and underflow…
Johannes Schaub - litb
  • 496,577
  • 130
  • 894
  • 1,212
57
votes
4 answers

c++ std::ostringstream vs std::string::append

In all examples that use some kind of buffering I see they use stream instead of string. How is std::ostringstream and << operator different than using string.append. Which one is faster and which one uses less resourses (memory). One difference I…
NickSoft
  • 3,215
  • 5
  • 27
  • 48
56
votes
7 answers

Convert StreamReader to byte[]

I am getting the result StreamReader object. I want to convert the result into byte[]. How can I convert StreamReaderto byte[]? Thanks
usr021986
  • 3,421
  • 14
  • 53
  • 64
55
votes
3 answers

What is Streams3 in Node.js and how does it differ from Streams2?

I've often heard of Streams2 and old-streams, but what is Streams3? It get mentioned in this talk by Thorsten Lorenz. Where can I read about it, and what is the difference between Streams2 and Streams3. Doing a search on Google, I also see it…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
54
votes
5 answers

Writing String to Stream and reading it back does not work

I want to write a String to a Stream (a MemoryStream in this case) and read the bytes one by one. stringAsStream = new MemoryStream(); UnicodeEncoding uniEncoding = new UnicodeEncoding(); String message =…
Deleted
  • 4,067
  • 6
  • 33
  • 51
53
votes
16 answers

Efficient way to search a stream for a string

Let's suppose that have a stream of text (or Reader in Java) that I'd like to check for a particular string. The stream of text might be very large so as soon as the search string is found I'd like to return true and also try to avoid storing the…
Alex Spurling
  • 54,094
  • 23
  • 70
  • 76