I'm trying to understand how image serialization works in WPF. I have the following class:
[Serializable]
public class TestClass : ISerializable
{
public TestClass() { }
protected TestClass(SerializationInfo info, StreamingContext context)
{
SerializedImage = (byte[])info.GetValue("SerializedImage", typeof(byte[]))...
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream("out.txt") ) ) );
So let me see if I understand this: A byte output stream is opened for file "out.txt". It is then fed to a buffered output stream to make file operations faster. The buffered stream is fed to an output str...
How do I make setw or something similar (boost format?) work with my user-defined ostream operators? setw only applies to the next element pushed to the stream.
For example:
cout << " approx: " << setw(10) << myX;
where myX is of type X, and I have my own
ostream& operator<<(ostream& os, const X &g) {
return os << "(" << g.a...
In C#, I almost always use the using pattern when working with stream objects. For example:
using (Stream stream = new MemoryStream())
{
// do stuff
}
By using the using block, we ensure that dispose is called on the stream immediately after that code bock executes.
I know Java doesn't have the eq...
Hi folks
I have been trying to find any way for writing asynchronously on a stream in Cocoa.
I have a set of events in my applications which will try to send data through the socket but i can't be blocked during this transmission due to design terms.
I have tried setting a delegate on the output stream and check the event NSStreamEven...
Hi everyone, I have a class in C++ which takes an std::ostream as an argument in order to continuously output text (trace information). I need to get this text over to the Java side as efficiently as possible. What's the best way to do this? I was thinking of using a direct buffer, but another method would be to take all the function cal...
I have data in the following format:
4:How do you do?
10:Happy birthday
1:Purple monkey dishwasher
200:The Ancestral Territorial Imperatives of the Trumpeter Swan
The number can be anywhere from 1 to 999, and the string is at most 255 characters long. I'm new to C++ and it seems a few sources recommend extracting formatted data with ...
I read about standard streams. My understanding is old fashioned programs that don't have GUI need some kind of user interface, too. So Operating System provide each of them with a console window, and the console window's out/input/err stream was mapped to the program's standard input/output/error stream. And thus these programs are call...
I have a failing C program, and i've narrowed it down to a fork()ed child trying to close stdout and stderr, which were closed by its parent process before calling fork() - i assume those streams were passed on to the child process.
how can i tell if a stream is closed in C before attempting to close it using something like fclose(stdou...
When you use ignore() in C++, is there a way to check those values that were ignored? I basically am reading some # of chars and want to know if I ignored normal characters in the text, or if I got the newline character first. Thanks.
...
I wrote several simulation programs in C++ and want to connect their outputs/inputs with pipes (best solution would probably be to use the C++ streams).
For this I would like to serialize some objects (for example the simulations output/input are tensors and matrices). How should I handle this problem? I searched around for some time fo...
Hi,
Today I got this question for which I think I answered very bad. I said stream is a data that flows and reader is a technique where we read from that is a static data. I know this is an awful answer, so please provide me the crisp difference and definitions between these two with example in Java.
Thanks.
...
Hi everyone, I'm having a bit of problem with an example I'm currently testing. For some reason, the execution blocks when writing at oos.writeObject(new SimpleObject());, despite that fact that the pipe should transfer the data across, even (I'd assume) if it had to do it in smaller operations due to a small pipe size. Anyway, the examp...
hi all,
i can establish a connection using HttpUrlConnection. my code below.
client = new DefaultHttpClient();
URL action_url = new URL(actionUrl);
conn = (HttpURLConnection) action_url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestProperty("userType", "2");
conn.setRequestProperty("Content-Type",
"app...
Hi everyone,
I am working with streams and sockets in iPhone SDK 3.1.3 the issue is when the program accept a callback and I want to handle this writestream callback the following error is triggered " Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSCFData writeStreamHandleEvent:]: unrecognized sele...
Hi everyone,
Debugging my implementation I found a memory leak issue. I know where is the issue, I tried to solve it but sadly without success. I will try to explain you, maybe someone of you can help with this.
First I have two classes involved in the issue, the publish class (where publishing the service and socket configuration is ...
Im writing a bash-script to perform an offsite backup, using rsync over SSH. I'm able to send STDOUT to logger, for logs via
rsync --del -az -e 'ssh -i mycrt.crt' /home/gnutt/backup/ me@offisite:backup | logger -i
But I want to send STDERR instead, so if there is a problem, such as that offsite is unavailable, that output should be se...
How can I get video and audio streams from web cameras with Java (in a cross-platform way)?
For example, we have a computer with 3-4 USB web cameras; we want to get their streams and make them visible in the user interface. How can we perform such a thing? I need code for a simple app which would find ALL cameras on the computer and let...
So I want to use JAVE to save mp3 radio stream to my File system. I have this code for file saving but what shall I do to save a stream (stop on timer for ex)
File source = new File("source.wav");
File target = new File("target.mp3");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Inte...
Hi,
I'm making tests with ASP.NET HttpHandler for download a file writting directly on the response stream, and I'm not pretty sure about the way I'm doing it. This is a example method, in the future the file could be stored in a BLOB in the database:
public void GetFile(HttpResponse response)
{
String fileName = "e...