001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.cache;
003
004import java.io.Serializable;
005import java.util.Arrays;
006
007/**
008 * Class that will hold JCS cache entries
009 *
010 * @author Wiktor Niesiobędzki
011 */
012public class CacheEntry implements Serializable {
013    private static final long serialVersionUID = 1L; //version
014    protected byte[] content;
015
016    /**
017     * @param content of the cache entry
018     */
019    public CacheEntry(byte[] content) {
020        this.content = Arrays.copyOf(content, content.length);
021    }
022
023    /**
024     * Returns cache entry content.
025     * @return cache entry content
026     */
027    public byte[] getContent() {
028        if (content == null) {
029            return new byte[]{};
030        }
031        return Arrays.copyOf(content, content.length);
032    }
033}