KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > net > io > CopyStreamException


1 /*
2  * Copyright 2001-2005 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 JavaDoc;
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 JavaDoc
30 {
31     private long totalBytesTransferred;
32     private IOException JavaDoc 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 JavaDoc message,
42                                long bytesTransferred,
43                                IOException JavaDoc 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 JavaDoc getIOException()
66     {
67         return ioException;
68     }
69 }
70
Popular Tags