01: /*
02: * Copyright 2001-2005 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
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: private long totalBytesTransferred;
31: private IOException ioException;
32:
33: /**
34: * Creates a new CopyStreamException instance.
35: * @param message A message describing the error.
36: * @param bytesTransferred The total number of bytes transferred before
37: * an exception was thrown in a copy operation.
38: * @param exception The IOException thrown during a copy operation.
39: */
40: public CopyStreamException(String message, long bytesTransferred,
41: IOException exception) {
42: super (message);
43: totalBytesTransferred = bytesTransferred;
44: ioException = exception;
45: }
46:
47: /**
48: * Returns the total number of bytes confirmed to have
49: * been transferred by a failed copy operation.
50: * @return The total number of bytes confirmed to have
51: * been transferred by a failed copy operation.
52: */
53: public long getTotalBytesTransferred() {
54: return totalBytesTransferred;
55: }
56:
57: /**
58: * Returns the IOException responsible for the failure of a copy operation.
59: * @return The IOException responsible for the failure of a copy operation.
60: */
61: public IOException getIOException() {
62: return ioException;
63: }
64: }
|