comparison servlet/src/digilib/image/JAIImageLoaderDocuImage.java @ 589:73e041c710d3 stream

more work on stream input
author robcast
date Thu, 06 Jan 2011 17:33:01 +0100
parents aee436f0549d
children 2b58d2783ef0
comparison
equal deleted inserted replaced
588:aee436f0549d 589:73e041c710d3
79 } 79 }
80 80
81 81
82 /* Load an image file into the Object. */ 82 /* Load an image file into the Object. */
83 public void loadImage(ImageInput ii) throws FileOpException { 83 public void loadImage(ImageInput ii) throws FileOpException {
84 logger.debug("loadImage: "+ii.getFile()); 84 logger.debug("loadImage: "+ii);
85 //System.gc(); 85 if (ii.hasImageInputStream()) {
86 img = JAI.create("ImageRead", ii.getFile().getAbsolutePath()); 86 img = JAI.create("ImageRead", ii.getImageInputStream());
87 } else if (ii.hasFile()) {
88 img = JAI.create("ImageRead", ii.getFile().getAbsolutePath());
89 }
87 if (img == null) { 90 if (img == null) {
88 throw new FileOpException("Unable to load File!"); 91 throw new FileOpException("Unable to load File!");
89 } 92 }
90 } 93 }
91 94
125 } 128 }
126 if (!readers.hasNext()) { 129 if (!readers.hasNext()) {
127 throw new FileOpException("Can't find Reader to load File!"); 130 throw new FileOpException("Can't find Reader to load File!");
128 } 131 }
129 reader = readers.next(); 132 reader = readers.next();
133 logger.debug("ImageIO: this reader: " + reader.getClass());
130 /* are there more readers? */ 134 /* are there more readers? */
131 logger.debug("ImageIO: this reader: " + reader.getClass());
132 /* while (readers.hasNext()) { 135 /* while (readers.hasNext()) {
133 logger.debug("ImageIO: next reader: " + readers.next().getClass()); 136 logger.debug("ImageIO: next reader: " + readers.next().getClass());
134 } */ 137 } */
135 reader.setInput(istream); 138 reader.setInput(istream);
136 return reader; 139 return reader;