001: /* ================================================================
002: * Cewolf : Chart enabling Web Objects Framework
003: * ================================================================
004: *
005: * Project Info: http://cewolf.sourceforge.net
006: * Project Lead: Guido Laures (guido@laures.de);
007: *
008: * (C) Copyright 2002, by Guido Laures
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: * See the GNU Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public License along with this
019: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020: * Boston, MA 02111-1307, USA.
021: */
022:
023: package de.laures.cewolf.storage;
024:
025: import java.io.Serializable;
026: import java.util.Date;
027:
028: import de.laures.cewolf.CewolfException;
029: import de.laures.cewolf.ChartImage;
030:
031: /**
032: * @author guido
033: *
034: */
035: public class SerializableChartImage implements ChartImage, Serializable {
036:
037: private final int width;
038: private final int height;
039: private final int type;
040: private final Date timeoutTime;
041: private final String mimeType;
042: private final byte[] data;
043:
044: public SerializableChartImage(ChartImage img)
045: throws CewolfException {
046: this .width = img.getWidth();
047: this .height = img.getHeight();
048: this .type = img.getType();
049: this .mimeType = img.getMimeType();
050: this .data = img.getBytes();
051: this .timeoutTime = img.getTimeoutTime();
052: }
053:
054: /**
055: * @see de.laures.cewolf.ChartImage#getWidth()
056: */
057: public int getWidth() {
058: return width;
059: }
060:
061: /**
062: * @see de.laures.cewolf.ChartImage#getHeight()
063: */
064: public int getHeight() {
065: return height;
066: }
067:
068: /**
069: * @see de.laures.cewolf.ChartImage#getType()
070: */
071: public int getType() {
072: return type;
073: }
074:
075: /**
076: * @see de.laures.cewolf.ChartImage#getBytes()
077: */
078: public byte[] getBytes() throws CewolfException {
079: return data;
080: }
081:
082: /**
083: * @see de.laures.cewolf.ChartImage#getMimeType()
084: */
085: public String getMimeType() {
086: return mimeType;
087: }
088:
089: /**
090: * @see de.laures.cewolf.ChartImage#getSize()
091: */
092: public int getSize() throws CewolfException {
093: return data.length;
094: }
095:
096: /* (non-Javadoc)
097: * @see de.laures.cewolf.ChartImage#getTimeoutTime()
098: */
099: public Date getTimeoutTime() {
100: return timeoutTime;
101: }
102:
103: }
|