franta-hg@1: /* ================================================================ franta-hg@1: * Cewolf : Chart enabling Web Objects Framework franta-hg@1: * ================================================================ franta-hg@1: * franta-hg@1: * Project Info: http://cewolf.sourceforge.net franta-hg@1: * Project Lead: Guido Laures (guido@laures.de); franta-hg@1: * franta-hg@1: * (C) Copyright 2002, by Guido Laures franta-hg@1: * franta-hg@1: * This library is free software; you can redistribute it and/or modify it under the terms franta-hg@1: * of the GNU Lesser General Public License as published by the Free Software Foundation; franta-hg@1: * either version 2.1 of the License, or (at your option) any later version. franta-hg@1: * franta-hg@1: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; franta-hg@1: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. franta-hg@1: * See the GNU Lesser General Public License for more details. franta-hg@1: * franta-hg@1: * You should have received a copy of the GNU Lesser General Public License along with this franta-hg@1: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, franta-hg@1: * Boston, MA 02111-1307, USA. franta-hg@1: */ franta-hg@1: franta-hg@1: package de.laures.cewolf.storage; franta-hg@1: franta-hg@1: import java.io.Serializable; franta-hg@1: import java.util.Date; franta-hg@1: franta-hg@1: import de.laures.cewolf.CewolfException; franta-hg@1: import de.laures.cewolf.ChartImage; franta-hg@1: franta-hg@1: /** franta-hg@1: * @author guido franta-hg@1: * franta-hg@1: */ franta-hg@1: public class SerializableChartImage implements ChartImage, Serializable { franta-hg@1: franta-hg@1: private final int width; franta-hg@1: private final int height; franta-hg@1: private final int type; franta-hg@1: private final Date timeoutTime; franta-hg@1: private final String mimeType; franta-hg@1: private final byte[] data; franta-hg@1: franta-hg@1: public SerializableChartImage(ChartImage img) throws CewolfException{ franta-hg@1: this.width = img.getWidth(); franta-hg@1: this.height = img.getHeight(); franta-hg@1: this.type = img.getType(); franta-hg@1: this.mimeType = img.getMimeType(); franta-hg@1: this.data = img.getBytes(); franta-hg@1: this.timeoutTime = img.getTimeoutTime(); franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @see de.laures.cewolf.ChartImage#getWidth() franta-hg@1: */ franta-hg@1: public int getWidth() { franta-hg@1: return width; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @see de.laures.cewolf.ChartImage#getHeight() franta-hg@1: */ franta-hg@1: public int getHeight() { franta-hg@1: return height; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @see de.laures.cewolf.ChartImage#getType() franta-hg@1: */ franta-hg@1: public int getType() { franta-hg@1: return type; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @see de.laures.cewolf.ChartImage#getBytes() franta-hg@1: */ franta-hg@1: public byte[] getBytes() throws CewolfException { franta-hg@1: return data; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @see de.laures.cewolf.ChartImage#getMimeType() franta-hg@1: */ franta-hg@1: public String getMimeType() { franta-hg@1: return mimeType; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @see de.laures.cewolf.ChartImage#getSize() franta-hg@1: */ franta-hg@1: public int getSize() throws CewolfException { franta-hg@1: return data.length; franta-hg@1: } franta-hg@1: franta-hg@1: /* (non-Javadoc) franta-hg@1: * @see de.laures.cewolf.ChartImage#getTimeoutTime() franta-hg@1: */ franta-hg@1: public Date getTimeoutTime() { franta-hg@1: return timeoutTime; franta-hg@1: } franta-hg@1: franta-hg@1: }