KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > fileupload > UploadedFileDefaultImplBase


1 /*
2  * Copyright 2004 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.myfaces.custom.fileupload;
17
18 import java.io.IOException JavaDoc;
19 import java.io.InputStream JavaDoc;
20
21
22 /**
23  * @author Sylvain Vieujot (latest modification by $Author: matze $)
24  * @version $Revision: 1.3 $ $Date: 2004/10/13 11:50:57 $
25  * $Log: UploadedFileDefaultImplBase.java,v $
26  * Revision 1.3 2004/10/13 11:50:57 matze
27  * renamed packages to org.apache
28  *
29  * Revision 1.2 2004/09/03 12:43:57 manolito
30  * File item transient in file based UploadedFile and no more empty constructors
31  *
32  */

33 public abstract class UploadedFileDefaultImplBase implements UploadedFile
34 {
35
36     private String JavaDoc _name = null;
37     private String JavaDoc _contentType = null;
38
39
40     protected UploadedFileDefaultImplBase(String JavaDoc name, String JavaDoc contentType)
41     {
42         _name = name;
43         _contentType = contentType;
44     }
45
46     /**
47      * Answer the uploaded file contents.
48      *
49      * @return file contents
50      */

51     public abstract byte[] getBytes() throws IOException JavaDoc;
52
53
54     /**
55      * Answer the uploaded file contents input stream
56      *
57      * @return
58      * @throws IOException
59      */

60     public abstract InputStream JavaDoc getInputStream() throws IOException JavaDoc;
61
62
63     /**
64      * @return Returns the _contentType.
65      */

66     public String JavaDoc getContentType()
67     {
68         return _contentType;
69     }
70
71
72     /**
73      * @return Returns the _name.
74      */

75     public String JavaDoc getName()
76     {
77         return _name;
78     }
79
80
81     /**
82      * Answer the size of this file.
83      * @return
84      */

85     public abstract long getSize();
86 }
87
Popular Tags