1 /*2 * Created on Jun 6, 20063 */4 package com.openedit.modules.image;5 6 import java.awt.image.BufferedImage ;7 import java.io.InputStream ;8 9 import javax.imageio.ImageIO ;10 11 import com.openedit.OpenEditRuntimeException;12 import com.openedit.modules.edit.EditSession;13 import com.openedit.util.FileUtils;14 15 public class ImageEditorSession extends EditSession16 {17 protected BufferedImage fieldEditImage;18 public BufferedImage getEditImage()19 {20 if( fieldEditImage == null)21 {22 InputStream in = null;23 try24 {25 in = getEditPage().getContentItem().getInputStream();26 fieldEditImage = ImageIO.read(in);27 }28 catch ( Exception ex)29 {30 throw new OpenEditRuntimeException(ex);31 }32 finally33 {34 FileUtils.safeClose(in);35 }36 }37 return fieldEditImage;38 }39 40 }41