/* ZipStorer.java * * Copyright (c) 2002, OS programming group * * This file is part of Gzz. * * Gzz is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Gzz is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with Gzz; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * */ /* * Written by os group */ package gzz.mediaserver.storage; import java.io.*; import java.util.*; import java.util.zip.*; /* (doc tbd) */ public class ZipStorer implements Storer { public ZipFile zipfile; Storer.DefaultPropertiesImpl def_prop_impl; public ZipStorer(ZipFile zipfile) throws IOException { this.zipfile = zipfile; def_prop_impl = new Storer.DefaultPropertiesImpl(this); } public OutputStream store(String key) throws IOException { throw new IOException(); } public void delete(String key) throws IOException { throw new IOException(); } public void setProperty(String name, String data) throws IOException { throw new IOException(); } public File getFile(String key) throws IOException{ return null; } public InputStream retrieve(String id) throws IOException { ZipEntry e = zipfile.getEntry(id); if(e != null) return zipfile.getInputStream(e); else return null; } public String getProperty(String s) { return def_prop_impl.getProperty(s); } public Set getKeys() throws IOException { Enumeration entries = zipfile.entries(); Set result = new HashSet(); for(; entries.hasMoreElements();) { ZipEntry e = (ZipEntry)entries.nextElement(); String name = e.getName(); result.add(name); } return result; } }