wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
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