This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: getting broken pipe error
Similar Threads
copying files
how to copy a .doc file through java
how to copy files at runtime
copying a file
Using fileoutputstream in a servlet