File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes getting broken pipe error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "getting broken pipe error" Watch "getting broken pipe error" New topic

getting broken pipe error

Sudhakar Reddy Kurakula
Ranch Hand

Joined: Aug 19, 2006
Posts: 42
// Copies src file to dst file.// If the dst file does not exist, it is createdvoid copy(File src, File dst) throws IOException { InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = > 0) {
out.write(buf, 0, len);

why some times i am getting broken pipe error

Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Does this code have anything to do with your other recent post about a broken pipe error? Since this code here deals with files and not sockets, and since the other code does not call this (or vice versa), it's hard to see any connection. If this code is somehow related to the other post, please post it there, and explain how the code is related. If this is unrelated, then please provide a stack trace that shows more info about the exception being thrown by this code.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: getting broken pipe error
It's not a secret anymore!