1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.net.io;
17
18 import java.io.IOException;
19
20 /**
21 * The CopyStreamException class is thrown by the org.apache.commons.io.Util
22 * copyStream() methods. It stores the number of bytes confirmed to
23 * have been transferred before an I/O error as well as the IOException
24 * responsible for the failure of a copy operation.
25 * @see Util
26 * @author <a href="mailto:savarese@apache.org">Daniel F. Savarese</a>
27 * @version $Id: CopyStreamException.java 165675 2005-05-02 20:09:55Z rwinston $
28 */
29 public class CopyStreamException extends IOException
30 {
31 private long totalBytesTransferred;
32 private IOException ioException;
33
34 /**
35 * Creates a new CopyStreamException instance.
36 * @param message A message describing the error.
37 * @param bytesTransferred The total number of bytes transferred before
38 * an exception was thrown in a copy operation.
39 * @param exception The IOException thrown during a copy operation.
40 */
41 public CopyStreamException(String message,
42 long bytesTransferred,
43 IOException exception)
44 {
45 super(message);
46 totalBytesTransferred = bytesTransferred;
47 ioException = exception;
48 }
49
50 /**
51 * Returns the total number of bytes confirmed to have
52 * been transferred by a failed copy operation.
53 * @return The total number of bytes confirmed to have
54 * been transferred by a failed copy operation.
55 */
56 public long getTotalBytesTransferred()
57 {
58 return totalBytesTransferred;
59 }
60
61 /**
62 * Returns the IOException responsible for the failure of a copy operation.
63 * @return The IOException responsible for the failure of a copy operation.
64 */
65 public IOException getIOException()
66 {
67 return ioException;
68 }
69 }