java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SerializableChartImage.java
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SerializableChartImage.java Sat Feb 28 21:31:02 2009 +0100
1.3 @@ -0,0 +1,102 @@
1.4 +/* ================================================================
1.5 + * Cewolf : Chart enabling Web Objects Framework
1.6 + * ================================================================
1.7 + *
1.8 + * Project Info: http://cewolf.sourceforge.net
1.9 + * Project Lead: Guido Laures (guido@laures.de);
1.10 + *
1.11 + * (C) Copyright 2002, by Guido Laures
1.12 + *
1.13 + * This library is free software; you can redistribute it and/or modify it under the terms
1.14 + * of the GNU Lesser General Public License as published by the Free Software Foundation;
1.15 + * either version 2.1 of the License, or (at your option) any later version.
1.16 + *
1.17 + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
1.18 + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1.19 + * See the GNU Lesser General Public License for more details.
1.20 + *
1.21 + * You should have received a copy of the GNU Lesser General Public License along with this
1.22 + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
1.23 + * Boston, MA 02111-1307, USA.
1.24 + */
1.25 +
1.26 +package de.laures.cewolf.storage;
1.27 +
1.28 +import java.io.Serializable;
1.29 +import java.util.Date;
1.30 +
1.31 +import de.laures.cewolf.CewolfException;
1.32 +import de.laures.cewolf.ChartImage;
1.33 +
1.34 +/**
1.35 + * @author guido
1.36 + *
1.37 + */
1.38 +public class SerializableChartImage implements ChartImage, Serializable {
1.39 +
1.40 + private final int width;
1.41 + private final int height;
1.42 + private final int type;
1.43 + private final Date timeoutTime;
1.44 + private final String mimeType;
1.45 + private final byte[] data;
1.46 +
1.47 + public SerializableChartImage(ChartImage img) throws CewolfException{
1.48 + this.width = img.getWidth();
1.49 + this.height = img.getHeight();
1.50 + this.type = img.getType();
1.51 + this.mimeType = img.getMimeType();
1.52 + this.data = img.getBytes();
1.53 + this.timeoutTime = img.getTimeoutTime();
1.54 + }
1.55 +
1.56 + /**
1.57 + * @see de.laures.cewolf.ChartImage#getWidth()
1.58 + */
1.59 + public int getWidth() {
1.60 + return width;
1.61 + }
1.62 +
1.63 + /**
1.64 + * @see de.laures.cewolf.ChartImage#getHeight()
1.65 + */
1.66 + public int getHeight() {
1.67 + return height;
1.68 + }
1.69 +
1.70 + /**
1.71 + * @see de.laures.cewolf.ChartImage#getType()
1.72 + */
1.73 + public int getType() {
1.74 + return type;
1.75 + }
1.76 +
1.77 + /**
1.78 + * @see de.laures.cewolf.ChartImage#getBytes()
1.79 + */
1.80 + public byte[] getBytes() throws CewolfException {
1.81 + return data;
1.82 + }
1.83 +
1.84 + /**
1.85 + * @see de.laures.cewolf.ChartImage#getMimeType()
1.86 + */
1.87 + public String getMimeType() {
1.88 + return mimeType;
1.89 + }
1.90 +
1.91 + /**
1.92 + * @see de.laures.cewolf.ChartImage#getSize()
1.93 + */
1.94 + public int getSize() throws CewolfException {
1.95 + return data.length;
1.96 + }
1.97 +
1.98 + /* (non-Javadoc)
1.99 + * @see de.laures.cewolf.ChartImage#getTimeoutTime()
1.100 + */
1.101 + public Date getTimeoutTime() {
1.102 + return timeoutTime;
1.103 + }
1.104 +
1.105 +}