Author: abelevich
Date: 2009-04-09 04:38:53 -0400 (Thu, 09 Apr 2009)
New Revision: 13450
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageLoader.java
Log:
remove ImageIO classes
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageLoader.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageLoader.java 2009-04-09
08:27:28 UTC (rev 13449)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageLoader.java 2009-04-09
08:38:53 UTC (rev 13450)
@@ -21,14 +21,11 @@
package org.richfaces.realworld.ui;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
-import javax.imageio.ImageIO;
-import javax.imageio.stream.ImageInputStream;
-import javax.imageio.stream.ImageOutputStream;
-
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
@@ -47,30 +44,31 @@
@In FileManager fileManager;
public void paintImage(OutputStream out, Object data) throws IOException {
- if (null == data) {
+
+ if (null == data) {
return;
}
+
File imageResource = null;
+
if(data.toString().endsWith(Constants.UPLOAD)){
imageResource = fileManager.getFileByAbsolutePath(data.toString());
}else{
imageResource = fileManager.getFileByPath(data.toString());
}
+
if (imageResource != null && imageResource.exists()) {
byte [] toWrite = new byte[Constants.DEFAULT_BUFFER_SIZE];
- ImageInputStream inputStream = ImageIO.createImageInputStream(imageResource);
- ImageOutputStream outputStream = ImageIO.createImageOutputStream(out);
+ FileInputStream in = new FileInputStream(imageResource);
try {
- while(inputStream.read(toWrite) != -1) {
- outputStream.write(toWrite);
- }
-
+ while(in.read(toWrite) != -1) {
+ out.write(toWrite);
+ }
} finally {
- outputStream.close();
- inputStream.close();
+ in.close();
}
}
Show replies by date