A stream is a series of data elements which can be accessed in a serial fashion.For Java 8’s new Stream API, use the java-stream tag instead.

3015
votes
55answers
1.6m views

Read/convert an InputStream to a String

If you have java.io.InputStream object, how should you process that object and produce a String?Suppose I have an InputStream that contains text data, and I want to convert this to a String. For ...
448
votes
11answers
231k views

How do I copy the contents of one stream to another?

What is the best way to copy the contents of one stream to another? Is there a standard utility method for this?
81
votes
3answers
181k views

Java Process with Input/Output Stream

I have the following code example below. Whereby you can enter a command to the bash shell i.e. echo test and have the result echo'd back. However, after the first read. Other output streams don't ...
106
votes
14answers
240k views

Java : How to determine the correct charset encoding of a stream

With reference to the following thread:Java App : Unable to read iso-8859-1 encoded file correctlyWhat is the best way to programatically determine the correct charset encoding of an inputstream/...
322
votes
20answers
333k views

Easy way to write contents of a Java InputStream to an OutputStream

I was surprised to find today that I couldn't track down any simple way to write the contents of an InputStream to an OutputStream in Java. Obviously, the byte buffer code isn't difficult to write, ...
1080
votes
6answers
526k views

How can I redirect and append both stdout and stderr to a file with Bash?

To redirect stdout to a truncated file in Bash, I know to use:cmd > file.txtTo redirect stdout in Bash, appending to a file, I know to use:cmd >> file.txtTo redirect both stdout and ...
559
votes
9answers
568k views

How do I save a stream to a file in C#?

I have a StreamReader object that I initialized with a stream, now I want to save this stream to disk (the stream may be a .gif or .jpg or .pdf).Existing Code:StreamReader sr=new StreamReader(...
248
votes
10answers
417k views

Download File to server from URL

Well, this one seems quite simple, and it is. All you have to do to download a file to your server is:file_put_contents("Tmpfile.zip", file_get_contents("http://someurl/file.zip"));Only there is ...
204
votes
4answers
150k views

How to download large file in python with requests.py?

Requests is a really nice library. I'd like to use it for download big files (>1GB).The problem is it's not possible to keep whole file in memory I need to read it in chunks. And this is a problem ...
69
votes
11answers
141k views

Reading large text files with streams in C#

I've got the lovely task of working out how to handle large files being loaded into our application's script editor (it's like VBA for our internal product for quick macros). Most files are about 300-...
93
votes
8answers
79k views

Can I redirect the stdout in python into some sort of string buffer?

I'm using python's ftplib to write a small FTP client, but some of the functions in the package don't return string output, but print to stdout. I want to redirect stdout to an object which I'll be ...
7
votes
1answer
3k views

Display data streamed from a Flask view as it updates

I have a view that generates data and streams it in real time. I can't figure out how to send this data to a variable that I can use in my HTML template. My current solution just outputs the data to ...
85
votes
9answers
125k views

Play audio from a stream using C#

Is there a way in C# to play audio (for example, MP3) direcly from a System.IO.Stream that for instance was returend from a WebRequest without saving the data temporarily to the disk?Solution with ...
66
votes
4answers
138k views

How to save/restore serializable object to/from file?

I have a list of objects and I need to save that somewhere in my computer. I have read some forums and I know that the object has to be Serializable. But it would be nice if I can get an example. For ...
286
votes
14answers
378k views

Fastest way to check if a file exist using standard C++/C++11/C?

I would like to find the fastest way to check if a file exist in standard C++11, C++, or C. I have thousands of files and before doing something on them I need to check if all of them exist. What can ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,