001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.util.resource;
018
019import java.io.IOException;
020import java.io.OutputStream;
021
022/**
023 * Special IResourceStream implementation that a Resource can return when it directly wants to write
024 * to an output stream instead of return the {@link IResourceStream#getInputStream()}. That one can
025 * return null for a IResourceStreamWriter.
026 *
027 * This behavior comes in use when the resource is generated on the fly and should be streamed
028 * directly to the client so that it won't be buffered completely if the generated resource is
029 * really big.
030 *
031 * @author jcompagner
032 */
033public interface IResourceStreamWriter extends IResourceStream
034{
035        /**
036         * Implement this method to write the resource data directly the the given {@link OutputStream}.
037         *
038         * @param output
039         *            The response where the resource can write its content into.
040         * @throws IOException 
041         */
042        void write(OutputStream output) throws IOException;
043}