diff servlet/src/digilib/io/ImageInputImpl.java @ 579:efd7a223f819 stream

try: ImageInput as interface, ImageFile inherits from Dirent and implements ImageInput
author robcast
date Wed, 22 Dec 2010 19:17:52 +0100
parents servlet/src/digilib/io/ImageInput.java@790cbfb58b52
children f210731dc6cc
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/servlet/src/digilib/io/ImageInputImpl.java	Wed Dec 22 19:17:52 2010 +0100
@@ -0,0 +1,81 @@
+/* ImageInput-- digilib image input interface.
+
+  Digital Image Library servlet components
+
+  Copyright (C) 2010 Robert Casties (robcast@mail.berlios.de)
+
+  This program is free software; you can redistribute  it and/or modify it
+  under  the terms of  the GNU General  Public License as published by the
+  Free Software Foundation;  either version 2 of the  License, or (at your
+  option) any later version.
+   
+  Please read license.txt for the full details. A copy of the GPL
+  may be found at http://www.gnu.org/copyleft/lgpl.html
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ * Created on 20.12.2010
+ */
+
+package digilib.io;
+
+import digilib.image.ImageSize;
+
+public abstract class ImageInputImpl implements ImageInput {
+
+	// mime file type
+	protected String mimetype = null;
+	// image size in pixels
+	protected ImageSize pixelSize = null;
+
+	/* (non-Javadoc)
+     * @see digilib.io.ImageInput#getSize()
+     */
+	@Override
+    public ImageSize getSize() {
+		return pixelSize;
+	}
+
+	/* (non-Javadoc)
+     * @see digilib.io.ImageInput#setSize(digilib.image.ImageSize)
+     */
+	@Override
+    public void setSize(ImageSize imageSize) {
+		this.pixelSize = imageSize;
+	}
+
+	/* (non-Javadoc)
+     * @see digilib.io.ImageInput#getMimetype()
+     */
+	@Override
+    public String getMimetype() {
+		return mimetype;
+	}
+
+	/* (non-Javadoc)
+     * @see digilib.io.ImageInput#setMimetype(java.lang.String)
+     */
+	@Override
+    public void setMimetype(String filetype) {
+		this.mimetype = filetype;
+	}
+
+	/* (non-Javadoc)
+     * @see digilib.io.ImageInput#isChecked()
+     */
+	@Override
+    public boolean isChecked() {
+		return (pixelSize != null);
+	}
+	
+	/* (non-Javadoc)
+     * @see digilib.io.ImageInput#getAspect()
+     */
+	@Override
+    public float getAspect() {
+		return (pixelSize != null) ? pixelSize.getAspect() : 0;
+	}
+	
+}
\ No newline at end of file