KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > mime > MimeException


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  *
22  * $Id: MimeException.java,v 1.1 2005/07/13 11:09:06 slobodan Exp $
23  */

24
25
26
27
28 package com.lutris.mime;
29
30 /**
31  * Public exception class to indicate an error in Mime data.
32  * This is never thrown by <code>MultiparMimeInputStream</code> since
33  * that class needs to look exactly like an <code>InputStream</code>.
34  */

35 public class MimeException extends Exception JavaDoc
36 {
37     /**
38      * Indicates a general error in parsing Mime data.
39      */

40     public static final int GENERIC = 0;
41     
42     /**
43      * Indicates incorrect Mime header syntax or illegal parameters.
44      */

45     public static final int INVALID_HEADER = 1;
46     
47     /**
48      * Indicates an illegal Mime type for a particular operation. For
49      * example, this code is generated if an attempt is made to create
50      * a <code>MultipartMimeInput</code> object with a Mime type other than
51      * <b>multipart/*</b>.
52      */

53     public static final int INVALID_MIME_TYPE = 2;
54     
55     /**
56      * Holds the reason code for this exception instance.
57      */

58     public int reason = GENERIC;
59
60     /**
61      * Creates a MimeException object with informational string
62      * <code>s</code> and reason code <code>reason</code>.
63      *
64      * @param s Informational string.
65      * @param reason Reason code.
66      */

67     MimeException(String JavaDoc s, int reason)
68     {
69     super(s);
70     this.reason = reason;
71     }
72
73     /**
74      * Creates a MimeException object with informational string
75      * <code>s</code> and the default reason code, <code>GENERIC</code>.
76      *
77      * @param s Informational string.
78      */

79     MimeException(String JavaDoc s)
80     {
81     super(s);
82     reason = GENERIC;
83     }
84     
85     /**
86      * Creates a MimeException object with informational string
87      * <code>s</code> and the default reason code, <code>GENERIC</code>.
88      *
89      * @param s Informational string.
90      */

91     MimeException()
92     {
93     super();
94     reason = GENERIC;
95     }
96 }
97
Popular Tags