Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting broken pipe error

 
Sudhakar Reddy Kurakula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// 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 = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}

why some times i am getting broken pipe error

--------------------------------------------------------------------------------
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic