/******************************************************************************* * Copyright (c) 2012 Torkild U. Resheim. * * All rights reserved. This program and the accompanying materials are made * available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Torkild U. Resheim - initial API and implementation *******************************************************************************/ package no.resheim.elibrarium.epub.core; import java.io.IOException; import java.io.InputStream; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.content.IContentDescriber; import org.eclipse.core.runtime.content.IContentDescription; import org.eclipse.mylyn.docs.epub.core.EPUB; /** * Used to verify whether or not the given input stream is an EPUB that can be * opened by the EPUB reader. * * @author Torkild U. Resheim */ public class EpubContentDescriber implements IContentDescriber { @Override public int describe(InputStream contents, IContentDescription description) throws IOException { if (EPUB.isEPUB(contents)) { return VALID; } else { return INVALID; } } @Override public QualifiedName[] getSupportedOptions() { return new QualifiedName[0]; } }