File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "getting broken pipe error" Watch "getting broken pipe error" New topic
Author

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 = 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

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