|
| ||||||||||
| Tags: function, inputstream, javaio, method, outputstream, programming language |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| getOutputStream() works only once
I have the following code: Launches a cpp program. Quote:
Code: try
{
cpin =new BufferedInputStream(new DataOutputStream(cpp.getOutputStream()));
cpin.write('a');
cpin.close();
}
catch(IOException err)
{ Const.error(err); } |
|
#2
| ||||
| ||||
| Re: getOutputStream() works only once
Hi, I think it comes from the close (), when you close the input stream a prior you can not reopen it. I think you should write the data twice on the tide. And remember one think if you do not close it properly at the correct time then the data will not be sent even if you try to flush it from there. Other than this I think I do not a have a solution for this.
__________________ Grand Theft Auto 4 PC Video Game |
|
#3
| ||||
| ||||
| Re: getOutputStream() works only once
Hello See, if removing the buffering may help you. Something like this, here is the code. Quote:
__________________ The FIFA Manager 2009 PC Game |
|
#4
| |||
| |||
| Re: getOutputStream() works only once
Hello, Thanks you for your advice, but that did not worked well. I think I'll use another method of communication between my code in C + + and Java in my code when two separate shipments must be made. For what I believe is that there is no solution (the JVM is apparently not capable of sending data to a stream without closing it). If you know any other logic than this then please let me know. |
|
#5
| ||||
| ||||
| Re: getOutputStream() works only once
Hello, In fact there is already a buffer in the stream that you retrieve with Process.getOutputStream (), so it must anyway be a flush (). If not for your comment on the JVM in general when you reach such a conclusion on something very basic, the problem is rather in your code, may be part of the C++ code? There NYI if that is specifically made for this kind of problem.
__________________ Grand Theft Auto 4 PC Video Game |
|
#6
| |||
| |||
| Re: getOutputStream() works only once
Hello, Quote:
Quote:
|
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "getOutputStream() works only once" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Google translate hover function works in Internet Explorer but doesn’t works any longer in Chrome | Pranvi | Technology & Internet | 5 | 26-08-2011 10:31 PM |
| How a CPU Works | billbebo | Motherboard Processor & RAM | 3 | 21-08-2009 03:20 PM |
| How to import from 7.0 works calender to 8.5 works calender? | migons | Windows Software | 3 | 19-08-2009 07:21 PM |
| ITunes doesn't works user account but works with admin account | Rupert | Windows Software | 2 | 20-02-2009 11:01 PM |
| 2GB RAM works but not 4GB | Deep23 | Motherboard Processor & RAM | 6 | 29-01-2009 06:33 PM |