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     */
017    package org.apache.logging.log4j.core.net.server;
018    
019    import java.io.IOException;
020    import java.io.InputStream;
021    
022    import org.apache.logging.log4j.core.LogEvent;
023    import org.apache.logging.log4j.core.LogEventListener;
024    
025    /**
026     * Reads {@link LogEvent}s from the given input stream and logs them as they are discovered on the given logger.
027     * 
028     * <p>
029     * Should be stateless.
030     * </p>
031     * 
032     * @param <T>
033     *            The kind of {@link InputStream} to wrap and read.
034     */
035    public interface LogEventBridge<T extends InputStream> {
036    
037        /**
038         * Reads {@link LogEvent}s from the given input stream and logs them as they are discovered on the given logger.
039         * 
040         * @param inputStream
041         *            the input stream to read
042         * @param logEventListener
043         *            TODO
044         * @throws IOException
045         */
046        void logEvents(T inputStream, LogEventListener logEventListener) throws IOException;
047    
048        /**
049         * Wraps the given stream if needed.
050         * 
051         * @param inputStream
052         *            the stream to wrap
053         * @return the wrapped stream or the given stream.
054         * @throws IOException
055         */
056        T wrapStream(InputStream inputStream) throws IOException;
057    }