comparison servlet/src/main/java/digilib/io/ImageInput.java @ 892:ba1eb2d821a2 mvnify

rearrange sources to maven directory standard
author robcast
date Tue, 19 Apr 2011 18:44:25 +0200
parents servlet/src/digilib/io/ImageInput.java@a630d0303cce
children
comparison
equal deleted inserted replaced
891:6584af320296 892:ba1eb2d821a2
1 /* ImageInput-- digilib image input interface.
2
3 Digital Image Library servlet components
4
5 Copyright (C) 2010 Robert Casties (robcast@mail.berlios.de)
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
11
12 Please read license.txt for the full details. A copy of the GPL
13 may be found at http://www.gnu.org/copyleft/lgpl.html
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 * Created on 20.12.2010
20 */
21
22 package digilib.io;
23
24 import java.io.File;
25 import java.io.InputStream;
26
27 import javax.imageio.stream.ImageInputStream;
28
29 import digilib.util.ImageSize;
30
31 public abstract class ImageInput {
32
33 // mime file type
34 protected String mimetype = null;
35 // image size in pixels
36 protected ImageSize pixelSize = null;
37 protected ImageSet parent = null;
38
39 /**
40 * @return ImageSize
41 */
42 public ImageSize getSize() {
43 return pixelSize;
44 }
45
46 /**
47 * Sets the imageSize.
48 * @param imageSize The imageSize to set
49 */
50 public void setSize(ImageSize imageSize) {
51 this.pixelSize = imageSize;
52 }
53
54 /** returns if mimetype has been set.
55 *
56 * @return String
57 */
58 public boolean hasMimetype() {
59 return (mimetype != null);
60 }
61
62 /**
63 * @return String
64 */
65 public String getMimetype() {
66 return mimetype;
67 }
68
69 /**
70 * Sets the mimetype.
71 * @param mimetype The mimetype to set
72 */
73 public void setMimetype(String filetype) {
74 this.mimetype = filetype;
75 }
76
77 /** returns if this image has been checked
78 * (i.e. has size and mimetype)
79 * TODO: deprecated
80 * @return boolean
81 */
82 public boolean isChecked() {
83 return (pixelSize != null);
84 }
85
86 /** Returns the aspect ratio of the image (width/height).
87 *
88 * @return
89 */
90 public float getAspect() {
91 return (pixelSize != null) ? pixelSize.getAspect() : 0f;
92 }
93
94 /**
95 * @return ImageSet
96 */
97 public ImageSet getParent() {
98 return parent;
99 }
100
101 /**
102 * Sets the parent.
103 * @param parent The parent to set
104 */
105 public void setParent(ImageSet parent) {
106 this.parent = parent;
107 }
108
109 /** Returns if the input can be returned as ImageInputStream.
110 *
111 * @return
112 */
113 public boolean hasImageInputStream() {
114 return false;
115 }
116
117 /** Returns the input as ImageInputStream (if available)
118 *
119 * @return
120 */
121 public ImageInputStream getImageInputStream() {
122 return null;
123 }
124
125 /** Returns if the input can be returned as InputStream.
126 *
127 * @return
128 */
129 public boolean hasInputStream() {
130 return false;
131 }
132
133 /** Returns the input as InputStream (if available)
134 *
135 * @return
136 */
137 public InputStream getInputStream() {
138 return null;
139 }
140
141 /** Returns if the input can be returned as File.
142 *
143 * @return
144 */
145 public boolean hasFile() {
146 return false;
147 }
148
149 /** Returns the input as File (if available)
150 *
151 * @return
152 */
153 public File getFile() {
154 return null;
155 }
156
157
158
159 }