diff servlet/src/digilib/image/DocuImageImpl.java @ 588:aee436f0549d stream

more work on stream input
author robcast
date Thu, 06 Jan 2011 14:37:50 +0100
parents beeedf90cb81
children 2b58d2783ef0
line wrap: on
line diff
--- a/servlet/src/digilib/image/DocuImageImpl.java	Thu Jan 06 11:57:32 2011 +0100
+++ b/servlet/src/digilib/image/DocuImageImpl.java	Thu Jan 06 14:37:50 2011 +0100
@@ -33,7 +33,6 @@
 import org.apache.log4j.Logger;
 
 import digilib.io.FileOpException;
-import digilib.io.ImageFile;
 import digilib.io.ImageInput;
 
 /** Simple abstract implementation of the <code>DocuImage</code> interface.
@@ -54,13 +53,13 @@
 	
 	/** epsilon for float comparisons. */
 	public final double epsilon = 1e-5;
-	
-	/** image mime-type */
-	protected String mimeType = null;
 
 	/** image size */
     protected ImageSize imgSize = null;
 
+    /** ImageInput that was read */
+    protected ImageInput input;
+
 	/**
 	 * Returns the quality.
 	 * @return int
@@ -100,14 +99,20 @@
 		scale(scale, scale);
 	}
 	
+	/* (non-Javadoc)
+	 * @see digilib.image.DocuImage#getMimetype()
+	 */
 	public String getMimetype() {
-		return mimeType;
+	    if (input != null) {
+	        return input.getMimetype();
+	    }
+	    return null;
 	}
 
     /* (non-Javadoc)
      * @see digilib.image.DocuImage#identify(digilib.io.ImageFile)
      */
-    public ImageInput identify(ImageFile imgf) throws IOException {
+    public ImageInput identify(ImageInput ii) throws IOException {
         // just a do-nothing implementation
         return null;
     }
@@ -129,7 +134,7 @@
 		return false;
 	}
 
-	public void loadSubimage(ImageFile f, Rectangle region, int subsample)
+	public void loadSubimage(ImageInput ii, Rectangle region, int subsample)
 		throws FileOpException {
 		// empty implementation
 	}
@@ -178,19 +183,11 @@
         return imgSize;
     }
 
-    public void loadImage(ImageFile f) throws FileOpException {
-        // TODO Auto-generated method stub
-        
-    }
+    public abstract void loadImage(ImageInput ii) throws FileOpException;
 
-    public void scale(double scaleX, double scaleY) throws ImageOpException {
-        // TODO Auto-generated method stub
-        
-    }
+    public abstract void scale(double scaleX, double scaleY) throws ImageOpException;
 
-    public void writeImage(String mt, OutputStream ostream)
-            throws ServletException, ImageOpException {
-        // TODO Auto-generated method stub
-    }
+    public abstract void writeImage(String mt, OutputStream ostream)
+            throws ServletException, ImageOpException;
 	
 }