streams

j2ee input output stream

i want to creat a pipe between clint browser<->my server <-> some other server .For downloadin some file. I am using apache tomcat as my server. How can i create the pipe via my server ? i dont have mucg space on my server . So i dont wan to save files on my server .I just want the download data to go via my server due to some reasons....

StreamReader.EndOfStream missing last line?

I am trying to read a text file using the code (pasted below), but the last line of the file does not get read. Is my logic correct? using (StreamReader reader = new StreamReader(stream)) { try { string line = reader.ReadLine(); string[] data = BreakLine(line); ...

"Safe handle has been closed" with SerialPort and a thread in C#

Good afternoon everybody! I have this threaded SerialPort wrapper that reads in a line from the serial port. Here is my thread's code. protected void ReadData() { SerialPort serialPort = null; try { serialPort = SetupSerialPort(_serialPortSettings); serialPort.Open(); string data; whi...

PHP Stream Notification Callback Not Invoked

I've been playing around with PHP Streams and have been experimenting by beginning to write the class shown here. The PHP docs are bit lean in this area to say the least. I'm having a difficult time with getting my stream context to invoke the callback method specified. If I use a function like file_get_contents or fopen to connect to a...

custom stream manipulator for class

Hello All, I am trying to write a simple audit class that takes input via operator << and writes the audit after receiving a custom manipulator like this: class CAudit { public: //needs to be templated CAudit& operator << ( LPCSTR data ) { audittext << data; return *this; } //attempted manipulator s...

efficient and flexible binary data parsing

I have an external device that spits out UDP packets of binary data and software running on an embedded system that needs to read this data stream, parse it and do somethign useful. The binary data gets logged to a file as well. I would like to write a parser that can easily take the input directly from either the UDP stream, or a file...

custom data iostream

I have a data structure defined as struct myDataStruct { int32_t header; int16_t data[8]; } and I want to take a character stream and turn it into a myData stream. What stream class should I extend? I would like to create a custom stream class so that I can do things like myDataStruct myData; myDataStruct myDataArray[10]; my...

ostringstream and ends

I've been working with somebody else's code and noticed that on all uses of ostringsteam they are in the habit of explicitly appending std::ends. This is something I've never done and have never encountered a problem. It doesn't appear to, but should std::ends make any difference in the following code? ostringstream message; message <...

Red5 live streaming

Hello guys, I'm new with Red5. I would like to know how can I take a stream from a port (something like this rr.tt.yy.uu:1234) and publish it using Red5. I was looking the oflaDema and the Simple Broadcaster, but this only takes the camera and I need to take the stream. Can you help me please?, may be with an example or a guideline. Th...

Fastest way to copy text from a File to a HttpServletResponse

Hi, I need a very fast way to copy text from a file to the body of a HttpServletResponse. Actually I'm copying byte by byte in a loop, from a bufferedReader to the response.getWriter() but I believe there must be a faster and more straightforward way of doing it. Thanks! ...

problem with flushing input stream C

I am not able to flush stdin here,is there a way to flush stdin?If not then how to make getchar() to take a character as input from user, instead of a "\n" left by scanf in the input buffer?? #include "stdio.h" #include "stdlib.h" int main(int argc,char*argv[]) { FILE *fp; char another='y'; struct emp { char name[40];...

Good way to send result of 'uname -a' to a stream?

Hello, What is a good way to call 'uname -a' from a C++ program and send the results to a stream? I looked at system() and exec(), but they do not seem to give access to the stdout of the call. Thanks. -William ...

How to easily indent output to ofstream?

Hi, Is there an easy way to indent the output going to an ofstream object? I have a C++ character array that is null terminate and includes newlines. I'd like to output this to the stream but indent each line with two spaces. Is there an easy way to do this with the stream manipulators like you can change the base for integer output ...

Playing multiple audio streams (mux) in silverlight

Is it possible to play a multiple audio streams (mux) in silverlight (at best simultaneous)? I need to implement a player that can load and play multiple tracks from the server together. The user can mute then any tracks to hear them selectively. Do you know some existing commercial or free solutions? ...

Is there a bitbucket in COM? Something like .NET's System.IO.Stream.Null?

I know about the ADODB.Stream object. But what I really want is a Stream for which calls to Write() are no-ops. Like System.IO.Stream.Null. I think ADODB.Stream is more like a MemoryStream, which accumulates the data in memory. And I cannot create an instance of System.IO.Stream.Null from COM, because it is a static property on t...

C# using streams

Streams are kind of mysterious to me. I don't know when to use which stream and how to use them. Can someone explain to me how streams are used? If I understand correctly there are three stream types: stream, read stream and write stream. Is this correct? And what is for example the difference between a Memorystream and a FileStream? ...

Is it possible to avoid temp files when a Java method expects Reader/Writer arguments?

I'm calling a method from an external library with a (simplified) signature like this: public class Alien { // ... public void munge(Reader in, Writer out) { ... } } The method basically reads a String from one stream and writes its results to the other. I have several strings which I need processed by this method, but none of...

Is it possible to wrap a .net Stream as an stl std::ostream*?

I have an unmanaged c++ library that outputs text to an std::ostream*. I call this from a managed c++ wrapper that is used by a c# library. Currently I pass the unmanaged code a pointer to a std::stringstream and then later call System.String(stringstream.str().c_str()) to copy my unmanaged buffer back into a .net friendly string. Is ...

Is it possible to determine a file descriptor's status in PHP?

I have a file descriptor (edit: the resource returned by fopen on a stream that is not necessarily a local file) that is being passed into a black box. When it pops out, is it possible to determine with any certainty whether or not the descriptor has been closed? Edit: It looks like the function get_resource_type($fd) will return "Unkn...

Is there an in memory stream that blocks like a file stream

I'm using a library that requires I provide an object that implements this interface: public interface IConsole { TextWriter StandardInput { get; } TextReader StandardOutput { get; } TextReader StandardError { get; } } The object's readers then get used by the library with: IConsole console = new MyConsole(); int readByte...