Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
142 views

Why does writing a value larger than the buffer size of Java's PipedInputStream cause it to hang indefinitely?

This Scala code hangs indefinitely import java.io._ import scala.io.Source import scala.concurrent._ import scala.concurrent.ExecutionContext.Implicits.global def copy(inputStream: InputStream, ...
alcorn's user avatar
  • 1,368
1 vote
0 answers
76 views

Why is this use of piped IO streams in Scala hanging indefinitely? [duplicate]

I'm playing around with the stream interfaces discussed in this blog post. I've made what feels like a simple implementation to test out the interfaces, but it is hanging indefinitely when I run it ...
alcorn's user avatar
  • 1,368
1 vote
1 answer
111 views

Java Process exec method won't let me pass input to a command

I'm practicing java.io methods, so I started by creating a script that prompts the user for a password and prints "correct" if the input is correct. Then, I wrote a java program that ...
TimatoPaste's user avatar
1 vote
0 answers
64 views

Adding scanf makes processInputStream in Java disappear

I tried to run a C program inside Java one and Java one is supposed to get stdin/stadout of my C program. The moment I add scanf to C code, C doesn't seem to see Java's output. When I make only ...
piotrj3's user avatar
  • 11
0 votes
2 answers
749 views

How to check whether a PrintStream is open without printing to it

I have a GUI program written in Java which outputs data to the command line using System.out.println. The data is intended to be piped into another program. As an example, I'll pipe the program ...
John Gowers's user avatar
  • 2,736
0 votes
1 answer
386 views

Java BufferedReader blocks on unix pipe

I am presently facing an issue while using BufferedReader to get an handle to a unix pipe. My java application first creates the pipe, then an external perl script executed through this java ...
user1619355's user avatar
1 vote
1 answer
179 views

Delegating error from writer thread of PipedWriter+PipedReader pair to the reader thread

What do I want? I have a PipedWriter + PipedReader pair with two threads. I want, that the exception catched in the writer thread would be thrown on the next operation of the PipedReader wrapped into ...
Gábor Lipták's user avatar
-2 votes
2 answers
3k views

How do you pipe the output of one file to input of another in Java?

Can someone show me code of something simple that pipes the output from one java file to the input of another in Java? Say you have a file that is called hello.java that just simply outputs "hello". ...
user3268401's user avatar
1 vote
1 answer
445 views

Java I/O to pipe

For some reason this code only works when I close the output stream. How can I get it to work without having to close it? I want to keep it open so I could keep sending data to the process without ...
jortiz81's user avatar
  • 559
0 votes
2 answers
647 views

Communication via standard input / output in Java

I am trying to send messages between two JVMs: a server starts a second process. The second process is then to send a message to the server which prints the message to the console. The code is as ...
coderino's user avatar
0 votes
1 answer
148 views

Wrap linux filter in java

I want to write a JUnit test that assures that our self-implemented XML canonicalization works just like "xmllint --c14n". ProcessBuilder pb = new ProcessBuilder("xmllint", "--c14n", "-"); ...
Bastl's user avatar
  • 3,016
3 votes
3 answers
4k views

Java read a logfile live

I'm writing a cod4 server controller in Java(I know there are perfectly fine server controllers out there, but I want to learn from it). Now I want to take specific actions according to entries in a ...
teuneboon's user avatar
  • 4,064
4 votes
1 answer
4k views

Wrapping a PipedInputStream with a BufferedInputStream

I have an OutputStream that I needed to read from, and so I used the following (Groovy) code to get an InputStream reference to the data: PipedInputStream inputStream = new PipedInputStream() ...
Greymeister's user avatar
7 votes
3 answers
10k views

How to copy input/output streams of the Process to their System counterparts?

This is a follow up to this question. The answer suggested there is to copy the Process out, err, and input streams to the System versions with IOUtils.copy as follows (after fixing various ...
vitaut's user avatar
  • 56.2k
2 votes
2 answers
3k views

Pipe data from InputStream to OutputStream in Java

I'd like to send a file contained in a ZIP archive unzipped to an external program for further decoding and to read the result back into Java. ZipInputStream zis = new ZipInputStream(new ...
Wangnick's user avatar
  • 735

15 30 50 per page