view artifact-database/src/main/java/de/intevation/artifactdatabase/rest/OutRepresentation.java @ 88:69c84cf7c5d7

Added javadoc to the REST package of the artifact database (complete). artifacts/trunk@840 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 26 Mar 2010 15:05:11 +0000
parents 48d1a9a082c2
children e27cf9c84eb8
line wrap: on
line source
package de.intevation.artifactdatabase.rest;

import org.restlet.representation.OutputRepresentation;

import org.restlet.data.MediaType;

import de.intevation.artifacts.ArtifactDatabase.DeferredOutput;

import java.io.IOException;
import java.io.OutputStream;

/**
 * Special representation to serve the out()-outputs
 * via DeferredOutput efficently .
 * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a>
 */
public class OutRepresentation
extends      OutputRepresentation
{
    /**
     * The deferred output fetched from ArtifactDatabase.out().
     */
    protected DeferredOutput out;

    /**
     * Constructor to create representation with a given MIME type and
     * a deferred output.
     * @param mediaType The MIME type of this representation.
     * @param out The deferred output from the ArtifactDatabase.out() call.
     */
    public OutRepresentation(MediaType mediaType, DeferredOutput out) {
        super(mediaType);
        this.out = out;
    }

    /**
     * Overwrites the write(OutputStream) of OutRepresentation to serve
     * the data from the deferred output.
     * @param output the stream where to write the data into.
     * @throws IOException Thrown if an exception occurred while writing
     * the data to the output stream.
     */
    public void write(OutputStream output) throws IOException {
        out.write(output);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org