streams

Using DOS/CMD/batch files how can you show Console output, and redirect the STDOUT and STDERR streams to files?

direct console to ok.log, and errors to error.log for example ...

Java socket streams end unexpectedly

I have an application handling several Java socket connections to different kinds of remote machines (some PCs, others are embedded devices). These sockets and streams should not close indefinitely except for a very good reason (e.g. crash of remote system). I frequently encounter an issue where the input stream ends unexpectedly, witho...

Sending a file via HTTP PUT in PHP

I've been struggling for several hours trying to figure out how to get this work. I'm trying to send a file via HTTP-PUT to an eXist db. There is user authentication for the server, so I was trying to do something like this: I have the URL where the doc is to be PUTted to I have the username and password for the eXist DB I have the co...

Java Socket Connections in Queue

Hey everyone, I have a client/server set up. The server (Provider.java) will accept 2 Socket connections. Each client, after they connect, are asked what type of game they would like to play - Tic Tac Toe, Chess, or Connect 5. Depending on their answer, the Socket connections are then stored in the particular game Queue. So, Tic...

What really Filter stream do?

Why does the filter stream used and where? I read that filter streams will be used for letting the needed information into the stream.. Is that right and if so how we can filter from the stream and where exactly it will be used?? java.io.Filter.... My problem here is its very hard to understand why we are using the Filter streams, Sinc...

How java.io.Buffer* stream differs from normal streams?

How buffered streams are working on the background and how it actually differs and what is the real advantage of using the same? Another Query,.. Since DataInputSytream is also Byte based, but it is having methods to readLine().. Whats the point in here ...

flush in java.io.FileWriter.

I have a question in my mind that, while writing into the file, before closing is done, should we include flush()??. If so what it will do exactly? dont streams auto flush?? EDIT: So flush what it actually do? ...

How do I get the InputStream of decompressed data from an InputStream of GZIPed data?

I call a service which returns a gzipped file. I have the data as an InputStream (courtesy of javax.activation.DataHandler.getInputStream();) from the response. What I would like to do is, without writing anything to disk, get an InputStream of the decompressed data in the file that is in the archive. The compressed file in this case i...

Difference between java.io.PrintWriter and java.io.BufferedWriter?

Please look through the below code, // A.java File file=new File("blah.txt"); FileWriter fwriter=new FileWriter(file); PrintWriter pwriter=new PrintWriter(fwriter); //B.java File file=new File("blah.txt"); FileWriter fwriter=new FileWriter(file); BufferedWriter bwriter=new BufferedWriter(bwriter); What is the difference between these...

java: StringBufferOutputWriter or StringBufferOutputStream?

I need to take a caught exception and get a String that is what would be printed using printStackTrace(). It looks like the simplest thing is to call printStackTrace(X), where X subclasses a PrintStream or PrintWriter, and gathers it to a StringBuilder and can return a String. Does such a thing exist? If not, any suggestions how to do ...

Problem getting Java Streams in HP Tandem (Non-Stop)

Hi. We are porting a simple Java application between Tandem NonStop systems, from G-Series to H-Series. Java version is 1.5.0_02. When performing basic I/O tasks like getting output stream from or opening a client socket, we receive exceptions like java.io.IOException: Value out of range or java.net.SocketException: Value out of ra...

C# Stream Design Question

I have an appliction right now that is a pipeline design. In one the first stage it reads some data and files into a Stream. There are some intermediate stages that do stuff to the stream of data. And then there is a final stage that writes the stream out to somewhere. This all happens serially, one stage completes and then hands off to ...

Compose output streams

I'd like to compose two (or more) streams into one. My goal is that any output directed to cout, cerr, and clog also be outputted into a file, along with the original stream. (For when things are logged to the console, for example. After closing, I'd like to still be able to go back and view the output.) I was thinking of doing somethin...

Chunkinfying stream. Is code correct? Need a second set of eyes.

Can anyone see any obvious holes in my logic here. Basically I need to break up a byte array into chunks of 10,000 before sending it out: byte [] bytes = GetLargePieceOfData(); Stream stream = CreateAStream(); if (bytes.Length > 10000) { int pos = 0; int chunkSize = 10000; while (pos < bytes.Length) { if (...

APN Error in Server Script (php)

Hi All, I am getting this error in my php script , while sending payload data. Warning: stream_socket_client() [function.stream-socket-client]: Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/test/apn/apns-dev.pem' in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42 Warning: stream_socket_client...

How do I convert an InputStream to a String in Java?

Suppose I have an InputStream that contains text data, and I want to convert this to a String (for example, so I can write the contents of the stream to a log file). What is the easiest way to take the InputStream and convert it to a String? public String convertStreamToString(InputStream is) { // ??? } ...

Can STDOUT and STDERR use different colors under XTerm / Konsole?

Is it even achievable? We need STDERR (ie. other streams then STDOUT) to have different colo(u)r. For example red. We use bash, terminal should be Konsole (XTerm, gnome terminal or any usable). Thanks if you know :-) ...

C# OutOfMemoryException on MemoryStream writing

I have a little sample application I was working on trying to get some of the new .Net 4.0 Parallel Extensions going (they are very nice). I'm running into a (probably really stupid) problem with an OutOfMemoryException. My main app that I'm looking to plug this sample into reads some data and lots of files, does some processing on them,...

XmlDocument.Save omitting elements

I have the following XML that is built up at runtime using an XmlDocument: <?xml version="1.0" standalone="yes"?> <NewConfig xmlns="http://tempuri.org/NewConfig.xsd"&gt; <SystemReference xmlns=""> <ID>1</ID> <Name>CountryName</Name> </SystemReference> <ClientList xmlns=""> <Type>Private</Type> <!-- elements omitte...

big streams with DataSnap

Hello, I'm trying to transfer some big streams (~1Mb) between DataSnap server/client but to no avail. I'm trying to understand the code of Jim Tierney (http://blogs.embarcadero.com/jimtierney/2009/04/06/31461) with no luck and i can't even compile the code because of a missing library, anyway ... The max size of a stream i`m able to r...