Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/obinary/cms/beans/Document.java


1   /**
2    *
3    * Magnolia and its source-code is licensed under the LGPL.
4    * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5    * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6    * you are required to provide proper attribution to obinary.
7    * If you reproduce or distribute the document without making any substantive modifications to its content,
8    * please use the following attribution line:
9    *
10   * Copyright 1993-2003 obinary Ltd. (http://www.obinary.com) All rights reserved.
11   *
12   * */
13  
14  
15  
16  
17  package com.obinary.cms.beans;
18  
19  
20  import com.obinary.cms.core.Atom;
21  
22  import java.io.*;
23  
24  
25  /**
26   * User: sameercharles
27   * Date: Apr 28, 2003
28   * Time: 11:20:59 AM
29   * @author Sameer Charles
30   * @version 1.0
31   */
32  
33  
34  public class Document {
35  
36  
37      private String atomName;
38      private String fileName;
39      private String extension;
40      private String type;
41      private java.io.File file;
42      private FileInputStream inputStream;
43  
44  
45  
46  
47  
48      /**
49       * package private constructor
50       */
51      Document () {}
52  
53  
54  
55      /**
56       *
57       */
58      public void setAtomName(String name) {
59          this.atomName = name;
60      }
61  
62  
63  
64      /**
65       *
66       */
67      public String getAtomName() {
68          return this.atomName;
69      }
70  
71  
72  
73      /**
74       *
75       */
76      public void setFileName(String name) {
77          this.fileName = name;
78      }
79  
80  
81  
82      /**
83       *
84       */
85      public String getFileName() {
86          return this.fileName;
87      }
88  
89  
90  
91      /**
92       *
93       */
94      public void setType(String type) {
95          this.type = type;
96      }
97  
98  
99  
100     /**
101      *
102      */
103     public String getType() {
104         return this.type;
105     }
106 
107 
108 
109     /**
110      *
111      */
112     public void setFile(java.io.File in) {
113         this.file = in;
114     }
115 
116 
117 
118     /**
119      *
120      */
121     public void setExtention(String ext) {
122         this.extension = ext;
123     }
124 
125 
126 
127     /**
128      *
129      */
130     public String getExtension() {
131         return this.extension;
132     }
133 
134 
135 
136     public long getLength() {
137         return this.file.length();
138     }
139 
140 
141 
142     public InputStream getStream() {
143         try {
144             return (this.inputStream = (new FileInputStream(this.file)));
145         } catch (FileNotFoundException e) {return null;}
146     }
147 
148 
149 
150     public void delete() {
151         try {
152             this.inputStream.close();
153         } catch (IOException e) {}
154         this.file.delete();
155     }
156 
157 
158 
159 
160 }